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.

Archive /

Our old forums are still available as a read-only archive.

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

Hiding or renaming generic form fields in the CMS


Reply


5 Posts   3052 Views

Avatar
cleve

Community Member, 6 Posts

29 January 2008 at 4:24am

Hiya,

Just trying to tidy up a page type I have which holds products, and thought it would be good if I could remove some of the forms and rename the generic 'Page Name' field to 'Product Name' on the cms.

What would be the best way to accomplish this?

Many Thanks
John Cleveley

Avatar
cleve

Community Member, 6 Posts

31 January 2008 at 2:27am

Was my question clear enough? all always tend to leave an important piece of information off :-)

John

Avatar
SilverRay

Community Member, 167 Posts

31 January 2008 at 1:20pm

If I understand your question correctly, you might have a look here:

http://doc.silverstripe.com/doku.php?id=page-types&s=removebyname

and here:

http://doc.silverstripe.com/doku.php?id=form&s=removebyname

Look for removeFieldFromTab() and removeByName()

Hope this helps...

Avatar
cleve

Community Member, 6 Posts

31 January 2008 at 11:05pm

Thanks mate that works great for removing form elements

Is there anyway to rename the label of inherited forms?

e.g. change the inherited "Page name" form label to "Product name" ?

Avatar
mikewheaton

Community Member, 9 Posts

21 October 2008 at 8:18am

Here's how I went about "renaming" the "Page name" field:

$fields->removeFieldFromTab('Root.Content.Main', 'Page name');

$fields->addFieldToTab('Root.Content.Main', new TextField('Title', 'Product name'));

This seems to be functioning correctly. Could someone with more experience let us know if this is good practise?