modalDescription('Configure the contact form block') ->schema([ TextInput::make('section_subtitle') ->label('Section Subtitle') ->default('Send Us Message') ->required(), Textarea::make('section_title') ->label('Section Title') ->default('Feel Free to Send Us Message') ->rows(2) ->required(), Repeater::make('subject_options') ->label('Subject Options') ->schema([ TextInput::make('label') ->label('Option Label') ->required(), TextInput::make('value') ->label('Option Value') ->required(), ]) ->defaultItems(3) ->minItems(1) ->maxItems(10) ->default([ ['label' => 'Subject', 'value' => ''], ['label' => 'Web Development', 'value' => 'web-development'], ['label' => 'Finance Consulting', 'value' => 'finance-consulting'], ]) ->collapsible() ->itemLabel(fn (array $state): ?string => $state['label'] ?? 'New Option'), ]); } public static function toPreviewHtml(array $config): string { return ''; } public static function toHtml(array $config, array $data): string { return new HtmlString(view('filament.forms.components.rich-editor.rich-content-custom-blocks.contact-form.index', [ 'section_subtitle' => $config['section_subtitle'] ?? 'Send Us Message', 'section_title' => $config['section_title'] ?? 'Feel Free to Send Us Message', 'subject_options' => $config['subject_options'] ?? [ ['label' => 'Subject', 'value' => ''], ['label' => 'Web Development', 'value' => 'web-development'], ['label' => 'Finance Consulting', 'value' => 'finance-consulting'], ], ])->render()); } }