Plugins
Unlayer
Wrapper for unlayer editor with unlayer templates custom select field.
Form Builder
Form Field
Dark theme support
No
Multi language support
No
Compatible with the latest version
Supported versions: 4.x
Documentation

image

Latest Version on Packagist GitHub Tests Action Status Total Downloads

This is a filament wrapper for unlayer editor with custom select field with unlayer templates.

#Requirements

  • PHP 8.2+
  • Laravel 10+
  • Filament 4.x

#Installation

You can install the package via composer:

composer require ZPMLabs/filament-unlayer

#Version Compatibility

  • Filament 4.x → Use this version (2.x)
  • Filament 3.x → Use version 1.x: composer require ZPMLabs/filament-unlayer:^1.0

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', ZPMLabs\FilamentUnlayer\Services\GetTemplates::find($state))
),
Unlayer::make('description')->required()

If you want to pass additional options to unlayer, which will join default object set by plugin with your additional data you can use:

Unlayer::make('description')
->additionalOptions([
'option' => 'value'
])

In case you want to customize SelectTemplate options you can chain these methods:

SelectTemplate::make('template')
->type('email') // or 'page', 'popup', ...
->isPremium(true) // shows only permium templates
->limit(50) // number of templates per search
->offset(0) // offset for pagination if needed
->collection('my-collection') // filtering by collection
->sortBy('recent') // or 'popular', 'oldest', ...

Or if you want to fully upgrade template selection by your custom code, you can do it by overriding 'templateResolver' => \ZPMLabs\FilamentUnlayer\Services\GetTemplates::class, config line.

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.

ZPMLabs

I’m Saša Orašanin — a passionate full-stack developer and architect who builds powerful tools using Laravel and Filament. Over the years, I've designed and delivered mission-critical systems and scalable applications that solve real business challenges.

3
Plugins
43
Stars
More from this author
Featured Plugins