SS3: Content and Settings

Content and Settings

New: don't put too much effort into this yet - things are now heading into the direction of one single page edit screen, with nested tabs!

In SilverStripe version 3 there is a slight difference in the way tabs are organized in the CMS. At the moment it looks like nested tabs will no longer be supported. As for editing pages, we now have two separate menu-items or sections if you will: Content and Settings. We find the original Content and Metadata tabs in the Content section, and the Behaviour and Access tabs in the Settings section. Todo has disappeared forever!

Two separate functions
To make the distinction between both sections, there are now two seperate functions as well: getCMSFields() for the Content section and getSettingsFields() for the Settings section. Both functions are basically exactly the same. We can add new tabs to each section, the way we always did, as long as we avoid the use of nested tabs for now.

In the developers group there are some rumours that nested tabs might be supported yet again, and the Settings menu-item disapear. These are only rumours but still I'll wait a bit before upgrading all my code accordingly...

Example

This is a bit of code from one of my test sites.

Content tabs:
Content: 'Root.Main'
Metadata: 'Root.Metadata',

Settings tabs:
Behaviour: 'Root.Settings'
Access: 'Root.Access'

function getCMSFields() {
	$fields = parent::getCMSFields();
	$fields->addFieldToTab("Root.Metadata",
		new CheckboxField(
			'ShowTwitterShare',
			_t('Page.SHOWTWITTERSHARE', 'Show the Tweet button')
		),
		'MetaKeywords'
	);
	return $fields;
}

function getSettingsFields() {
	$fields = parent::getSettingsFields();
	$fields->addFieldToTab("Root.Settings",
		new CheckboxField(
			'AddToFooterMenu',
			_t('Page.ADDTOFOOTERMENU', 'Add this page to the footer menu')
		)
	);
	return $fields;
}

Comments

Het versturen van reacties is uitgeschakeld.

RSS feed voor reacties op deze pagina