Add links to Rich Editor search link section
1
If you want to add links to the rich editor "choose link" section
The links will appear in this dropdown
In your plugin boot
method add those two events.
Event::listen('backend.richeditor.listTypes', function () {
return [
'your_type' => 'Title',
];
});
Event::listen('backend.richeditor.getTypeInfo', function ($type) {
if ($type === 'your_type') {
return Model::getRichEditorTypeInfo($type);
}
});
In your model prepare the generate url logic.
public static function getRichEditorTypeInfo($type)
{
if ($type == 'your_type') {
$yourTypes = self::all();
$selectOptions = []; //array to populate with urls
foreach ($yourTypes as $type) {
$selectOptions['your url'] = [
'title' => 'Your title',
// 'items'=> additional items added as subsection
];
}
return $selectOptions;
}
return [];
}
There are no comments yet
Be the first one to comment