infinityxtech / filament-unlayer
Filament wrapper for unlayer editor.
Fund package maintenance!
InfinityXTech
Requires
- php: ^8.1
- filament/filament: ^3.0
- filament/forms: ^3.0
- spatie/laravel-package-tools: ^1.15.0
Requires (Dev)
- laravel/pint: ^1.0
- nunomaduro/collision: ^7.9
- nunomaduro/larastan: ^2.0.1
- orchestra/testbench: ^8.0
- pestphp/pest: ^2.1
- pestphp/pest-plugin-arch: ^2.0
- pestphp/pest-plugin-laravel: ^2.0
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- spatie/laravel-ray: ^1.26
README
This is a filament wrapper for unlayer editor with custom select field with unlayer templates.
Installation
You can install the package via composer:
composer require InfinityXTech/filament-unlayer
Create a cast within your model:
protected $casts = [ 'content' => 'array', ];
You can publish the config file with:
php artisan vendor:publish --tag="filament-unlayer-config"
Optionally, you can publish the views using
php artisan vendor:publish --tag="filament-unlayer-views"
Usage
As any other filament form field:
Unlayer::make('content')->required()
In case you want to select unlayer templates you can use:
SelectTemplate::make('template'), Unlayer::make('content')->required()
By default the Unlayer field name should content
but if you need to change it you will need to update SelectTemplate
:
SelectTemplate::make('template') ->afterStateUpdated(fn (string $operation, $state, Forms\Set $set) => $set('description', InfinityXTech\FilamentUnlayer\Services\GetTemplates::find($state)) ), Unlayer::make('description')->required()
You can still chain other methods on these since:
SelectTemplate
is extending filament Select
field.
Unlayer
is extending filament Field
class.
Changelog
Please see CHANGELOG for more information on what has changed recently.
License
The MIT License (MIT). Please see License File for more information.