Jump to:

5450 Posts in 1672 Topics by 1197 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Simple Problem - Add descriptions to CSM fields?

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

Page: 1
Go to End
Author Topic: 1406 Views
  • b0bro
    Avatar
    Community Member
    38 Posts

    Simple Problem - Add descriptions to CSM fields? Link to this post

    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

  • JoshuaLewis
    Avatar
    Community Member
    76 Posts

    Re: Simple Problem - Add descriptions to CSM fields? Link to this post

    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.

  • kevino
    Avatar
    Community Member
    30 Posts

    Re: Simple Problem - Add descriptions to CSM fields? Link to this post

    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 "(" & ")"

  • ajshort
    Avatar
    Community Member
    244 Posts

    Re: Simple Problem - Add descriptions to CSM fields? Link to this post

    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.

    1406 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.