class MyCustomBlock extends RichContentCustomBlock
{
public static function getId(): string
{
return 'my-custom-block';
}
public static function getLabel(): string
{
return 'My Custom Block';
}
public static function configureEditorAction(Action $action): Action
{
return $action
->modalDescription('My Custom Block')
->schema([
TextInput::make('author')->required(),
TextInput::make('content'),
]);
}
public static function toPreviewHtml(array $config): string
{
return <<<HTML
<blockquote>
{$config['content']}
<cite>- {$config['author']}</cite>
</blockquote>
HTML;
}
public static function toHtml(array $config, array $data): string
{
return static::toPreviewHtml($config);
}
}
class MyCustomBlock extends RichContentCustomBlock
{
public static function getId(): string
{
return 'my-custom-block';
}
public static function getLabel(): string
{
return 'My Custom Block';
}
public static function configureEditorAction(Action $action): Action
{
return $action
->modalDescription('My Custom Block')
->schema([
TextInput::make('author')->required(),
TextInput::make('content'),
]);
}
public static function toPreviewHtml(array $config): string
{
return <<<HTML
<blockquote>
{$config['content']}
<cite>- {$config['author']}</cite>
</blockquote>
HTML;
}
public static function toHtml(array $config, array $data): string
{
return static::toPreviewHtml($config);
}
}