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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Customising the CMS /

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

Simple Problem - Add descriptions to CSM fields?


Go to End


4 Posts   3559 Views

Avatar
b0bro

Community Member, 38 Posts

23 August 2009 at 4:44pm

Hi,

Is it possible to add small descriptions to cms fields?
Example, I have an image field named PhotoHome

$fields->addFieldToTab("Root.Content.Photos", new ImageField('PhotoHome'));

*First of all I would like to know how to put a space in-between Photo and Home (in cms it appears as one) and;
*Second of all I would like to add a small description like "This is the photo that will appear on the homepage"

Thanks for any help.

Byron

Avatar
JoshuaLewis

Community Member, 81 Posts

12 December 2009 at 6:15pm

I'm also looking for ways of adding descriptions and notes to fields in the CMS, especially with images so the editor can get an idea of what dimensions or aspect ratio is expected by the templates.

As far as changing the name there is a second parameter to the ImageField() class that sets a title.

Currently I'm looking at two ideas for easily adding notes to CMS fields. One is to place them in the title parameter which isn't so great seeing as the layout and styling of the CMS assumes the titles are short. The other is to use LiteralField() to add the text with appropriate markup and possibly even some inline styles. I haven't done any tests with the second one yet so I'm not sure how well it works.

Avatar
kevino

Community Member, 30 Posts

26 January 2010 at 2:02am

try this:

$fields->addFieldToTab("Root.Content.Photos", new ImageField('PhotoHome', 'Photo Home (This is the photo that will appear on the homepage)')); 

( and ) are brackets "(" & ")"

Avatar
ajshort

Community Member, 244 Posts

26 January 2010 at 2:13am

The proper way to do this is to call $field->setRightTitle('A longer description here');. This is displayed under the field in the CMS in smaller text.