Skip to content

Instantly share code, notes, and snippets.

@khoatran
Last active January 24, 2019 15:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save khoatran/120278106929c8c1314385364057f86f to your computer and use it in GitHub Desktop.
Save khoatran/120278106929c8c1314385364057f86f to your computer and use it in GitHub Desktop.
OctoberCMS add fields under secondary tabs
<?php
class Plugin extends PluginBase
{
public function boot()
{
parent::boot();
$this->extendRainlabPost();
}
protected function extendRainlabPost() {
Posts::extendFormFields(function (Form $form, $model, $context) {
if (!$model instanceof \RainLab\Blog\Models\Post) {
return;
}
$form->addSecondaryTabFields([
'sticky' => [
'label' => 'Sticky post',
'type' => 'switch',
'tab' => 'rainlab.blog::lang.post.tab_manage'
]
]);
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment