PHP code example of klisica / filament-builder-blocks
1. Go to this page and download the library: Download klisica/filament-builder-blocks library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
klisica / filament-builder-blocks example snippets
class ExampleHero extends AbstractSectionItemProvider
{
public function getFieldset(): Fieldset
{
return Fieldset::make($this->getName())
->schema([
Placeholder::make('contact_links')->columnSpanFull(), // Will get cleared out.
TextInput::make('content.heading'), // Will keep on save methods.
]);
}
}
protected function mutateFormDataBeforeSave(array $data): array
{
return (new FilamentBuilderBlocks)->cleanup($data);
}
$sections = (new FilamentBuilderBlocks)->renderSections(
sections: $pages->content, // Page sections stored in content column
wrappingSections: $layout->content // Layout sections stored in content column (
@foreach($sections as $section)
{!! $section !!}
@endforeach