* Page builder foundation * Form builder document type * Dashboard builder document type * Report builder document type * Menu builder document type * Email builder document type * Query builder document type * Workflow builder document type * Reusable component registry * Form-field registry * Dashboard-widget registry * Hero, heading, and rich-content components * JSON document schema * Saved builder documents * Draft, published, and archived states * Document version history * Reusable builder templates * Component rendering service * Extensible BuilderComponent contract * Authenticated Builder REST endpoints * Administration navigation * Builder permissions * Module registration and test
13 lines
756 B
PHP
13 lines
756 B
PHP
<?php
|
|
namespace Modules\Builder\Components;
|
|
use Modules\Builder\Contracts\BuilderComponent;
|
|
final class HeadingComponent implements BuilderComponent
|
|
{
|
|
public function type(): string { return 'heading'; }
|
|
public function label(): string { return 'Heading'; }
|
|
public function category(): string { return 'Typography'; }
|
|
public function schema(): array { return ['text'=>['type'=>'text','required'=>true],'level'=>['type'=>'select','options'=>[1,2,3,4,5,6]]]; }
|
|
public function defaults(): array { return ['text'=>'Heading','level'=>2]; }
|
|
public function render(array $properties, array $context=[]): string { $level=max(1,min(6,(int)($properties['level']??2))); return '<h'.$level.'>'.e($properties['text']??'').'</h'.$level.'>'; }
|
|
}
|