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.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Customising the CMS /

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

$fields->addFieldToTab not working ver 2.3 RC3


Go to End


3 Posts   2702 Views

Avatar
BuddhaSource

Community Member, 57 Posts

1 February 2009 at 4:05am

Hi,

Well custom Fields is not working for me in 2.3 rc2 and RC3 but working just fine in ver 2.2.3

I wanted to know if I am doing somthing wrong or there is a bug.
The database all get created when we do db flush etc but in the admin end
all I see is the empty tab with no field.
Also RemoveTab is working fine.

Here is my code sniped.

My whole work has come to stop cause of this.

function getCMSFields() {
		   $fields = parent::getCMSFields();
		 
			$fields->addFieldToTab('Root.Content.SidebarText', new HtmlEditorField('SidebarText'), 'SidebarText');
		   $fields->addFieldToTab("Root.Content.SidebarText", new ImageField('Image1'),'content'); 
		   $fields->addFieldToTab("Root.Content.SidebarText", new ImageField('Image2'),'content');
		   $fields->addFieldToTab("Root.Content.SidebarText", new ImageField('Image3'),'content');
		   $fields->addFieldToTab('Root.Content.SidebarText', new HtmlEditorField('SidebarTextBottom'), 'SidebarTextBottom');
		    	
		   return $fields;
		}	

Avatar
dio5

Community Member, 501 Posts

1 February 2009 at 5:34am

Hi,

Do you have a 'content' field in the SidebarText tab?

You're doing:

$fields->addFieldToTab("Root.Content.SidebarText", new ImageField('Image1'),'content');

Which would only make sense if you want to add it before the 'content' field (note it's really 'Content').
If you don't have a content field in that tab, try with leaving out 'content'.

It might be a bug or possibly 2.3 RC3 has become a bit stricter and doesn't allow this kind of error anymore.

Avatar
BuddhaSource

Community Member, 57 Posts

1 February 2009 at 7:08am

Thanks dio5

2.3 RC3 has become stricter :(

The solution was to simply remove content and keep it empty.
Finally all set and ready to start working.