I'd like some example also.
I'd like to know how to do a "drop tab" just like the metadata has! that way it could save space.
I have figured out how to add a tab
eg Info panel
extract
$fields->addFieldToTab("Root.IntroPanel",
new HTMLEditorField('IntroPanelOne',
_t('Page.ColumnOne','Panel1')
)
);
full
<?php
class Page extends SiteTree {
public static $db = array(
'topnav' => 'Boolean',//menu
'IntroPanelOne' => 'HTMLText',
'IntroPanelTwo' => 'HTMLText',
'IntroPanelThree' => 'HTMLText'
);
public static $has_one = array(
//'Page' => 'SiteTree'
);
static $defaults = array(
'topnav' => 1
);
function getCMSFields() {
$fields = parent::getCMSFields();
//menu
$fields->addFieldToTab("Root.Main",
new CheckboxField(
'topnav',
_t('Page.topnav', 'Tick to show on top nav')
),
'Content'
);
$fields->addFieldToTab("Root.IntroPanel",
new HTMLEditorField('IntroPanelOne',
_t('Page.ColumnOne','Panel1')
)
);
$fields->addFieldToTab("Root.IntroPanel",
new HTMLEditorField('IntroPanelTwo',
_t('Page.ColumnOne','Panel2')
)
);
$fields->addFieldToTab("Root.IntroPanel",
new HTMLEditorField('IntroPanelThree',
_t('Page.ColumnOne','Panel3')
)
);
//Main
return $fields;
} //endgetCMSFields