Skip to content

Instantly share code, notes, and snippets.

@ManojKiranA
Forked from awcodes/BlockSettings.php
Created November 14, 2022 04:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ManojKiranA/0ef91336f6f0fb7bcdb8921e37a6a0e5 to your computer and use it in GitHub Desktop.
Save ManojKiranA/0ef91336f6f0fb7bcdb8921e37a6a0e5 to your computer and use it in GitHub Desktop.
Filament Block Settings
<div
{{ $attributes->merge($getExtraAttributes()) }}
>
<details
class="open:bg-white dark:open:bg-slate-900/50 open:border-b open:border-gray-300 open:dark:border-gray-700 p-4 -mx-4 -mt-4 -mb-4 open:mb-0"
wire:ignore.self
wire:key="{{ $this->id }}.{{ $getStatePath() }}.block-settings"
>
<summary class="filament-link cursor-pointer text-sm">Block Settings</summary>
<div class="pt-6">
{{ $getChildComponentContainer() }}
</div>
</details>
</div>
<?php
namespace App\Forms\Components;
use Filament\Forms\Components\Group;
class BlockSettings extends Group
{
protected string $view = 'filament.forms.components.block-settings';
protected function setUp(): void
{
$this->statePath('settings');
$this->columnSpan('full');
$this->columns(['md' => 12, 'lg' => null]);
}
}
Block::make('rich-text')
->label('Rich Text')
->schema([
BlockSettings::make([
...fields
]),
...
]),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment