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.

Customising the CMS /

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

New CMS Fields Help

Go to End

3 Posts   3608 Views


Community Member, 7 Posts

14 January 2009 at 12:51am

Hi all. New to Silverstripe, so far I think it's a great tool, having lots of fun learning. Have been trying to add new fields to the CMS and am having some trouble. Followed the tutorials on adding Date and Author fields, from there figured out how to add two new text fields and pull them into the CMS:

class HomePage extends Page {
static $db = array(
'Recent Work' => 'Text',
'New Work' => 'Text'
static $has_one = array(

function getCMSFields() {
$fields = parent::getCMSFields();

$fields->addFieldToTab('Root.Content.Main', new TextField('Recent Work'));
$fields->addFieldToTab('Root.Content.Main', new TextField('New Work'));

return $fields;

The problem I'm having is that I can't get the fields to display text-wrapping. Right now, they both show up under $Content, which is where I want them, but they only display a single line. I'd like them to function similarly to the $Content field - e.g. expanding as needed when data dictates. Also, the default font that is applied to content in these new fields appears different to that applied to data put into the $Content field. I know fonts will be handled on the site by my CSS, but it seems odd that new fields don't correspond with the existing format. Might be useful if the tutorial addressed this type of customization as opposed to just the single line examples. Thanks in advance for any help and or insights.


Community Member, 25 Posts

14 January 2009 at 1:55am


The input fields are one line, as you have choosen the TextField as the type (the new TextField("XXX", "XXX");

Check this wiki page:

Here you can see that the "TextareaField" is a multiline text input and if you like it as the $Content, you should use "HtmlEditorField". Please note, that if you choose to use the HtmlEditorField, you should also change the $db array from "Text" to "HTMLText". See:

Hope this helps,


Community Member, 7 Posts

14 January 2009 at 1:43pm

Thanks much Tobbe! Worked out exactly as I hoped.