<?php
namespace PackiMaster\Bio\Forms\Components;
use Filament\Forms\Components\RichEditor;
use Filament\Forms\Set;
class CustomBio extends RichEditor
{
protected string $view = 'bio::forms.components.bio-editor';
protected array|\Closure $mentionsItems = [];
public function setUp(): void
{
parent::setUp();
// Adding a hook to modify the form data on submission
$this->afterStateHydrated(function ($component, $state, Set $set) {
// Original state remains untouched
$set($this->getStatePath(), $state);
// Add mentions as separate data
$set('bio_with_style', 'SOME_EXTRA_CUSTOMIZATION');
});
}
}
<?php
namespace PackiMaster\Bio\Forms\Components;
use Filament\Forms\Components\RichEditor;
use Filament\Forms\Set;
class CustomBio extends RichEditor
{
protected string $view = 'bio::forms.components.bio-editor';
protected array|\Closure $mentionsItems = [];
public function setUp(): void
{
parent::setUp();
// Adding a hook to modify the form data on submission
$this->afterStateHydrated(function ($component, $state, Set $set) {
// Original state remains untouched
$set($this->getStatePath(), $state);
// Add mentions as separate data
$set('bio_with_style', 'SOME_EXTRA_CUSTOMIZATION');
});
}
}