Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

SilverStripe 3 ..Tabs!


Reply


3 Posts   775 Views

Avatar
DesignerX.com.au

Community Member, 107 Posts

7 June 2012 at 4:25pm

Hi:
How does the new tabs in the CMS work? Can we have sub-tabs anymore ?
For example, If i have Gallerypage i will need the following tabs:
Content->
Gallery->Images
Gallery->Settings
Gallery->AdvancedSettings (With access limited to a member or group )
Settings -> ... & so on

Does sub-tabs work anymore ? if so, how do i get them working.
Thanks

Avatar
merrick_sd

Community Member, 95 Posts

10 November 2012 at 1:33am

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

Avatar
pbenoit

Community Member, 9 Posts

22 January 2014 at 8:49am

The way to achieve the drop down like Matatags is like this.

$fields->addFieldToTab("Root.Main", new ToggleCompositeField('UniqueName', 'Section Name',
      array(
         new TextField('HeroTitle', 'Title'),
      )
   ), 'Metadata');