Skip to content

Instantly share code, notes, and snippets.

@vojtasvoboda
Last active July 28, 2022 15:49
Show Gist options
  • Save vojtasvoboda/833d67afebfcdbf204ce to your computer and use it in GitHub Desktop.
Save vojtasvoboda/833d67afebfcdbf204ce to your computer and use it in GitHub Desktop.
Extend backend form in OctoberCMS
<?php
public function boot()
{
// Extend all backend form usage
Event::listen('backend.form.extendFields', function($widget) {
// Only for the Posts controller
if (!$widget->getController() instanceof \RainLab\Blog\Controllers\Posts)
return;
// Only for the Post model
if (!$widget->model instanceof \RainLab\Blog\Models\Post)
return;
// Update content field
$widget->addSecondaryTabFields([
'content' => [
'tab' => 'rainlab.blog::lang.post.tab_edit',
'type' => 'richeditor',
'size' => 'huge',
]
]);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment