39 lines
768 B
PHP
39 lines
768 B
PHP
<?php
|
|
|
|
namespace Modules\Builder\Components;
|
|
|
|
use Modules\Builder\Contracts\BuilderComponent;
|
|
|
|
final class ContentComponent implements BuilderComponent
|
|
{
|
|
public function type(): string
|
|
{
|
|
return 'content';
|
|
}
|
|
|
|
public function label(): string
|
|
{
|
|
return 'Rich Content';
|
|
}
|
|
|
|
public function category(): string
|
|
{
|
|
return 'Content';
|
|
}
|
|
|
|
public function schema(): array
|
|
{
|
|
return ['content' => ['type' => 'textarea', 'required' => true]];
|
|
}
|
|
|
|
public function defaults(): array
|
|
{
|
|
return ['content' => '<p>Add your content here.</p>'];
|
|
}
|
|
|
|
public function render(array $properties, array $context = []): string
|
|
{
|
|
return (string) ($properties['content'] ?? '');
|
|
}
|
|
}
|