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, biapar, Willr, Ingo, swaiba

SS 3.0 Best way to change HTMLEditorField rows in CMS


Go to End
Reply


8 Posts   1610 Views

Avatar
theoldlr

Community Member, 103 Posts

23 February 2013 at 6:36pm

Prior to 3.0 I know you used to be able to specify the number of rows you wanted in the constructor of an HTMLEditorField, but that is no longer the case. Is there a new method for changing properties of the HTMLEditorField, or perhaps a new field for shorter content in SS3 I haven't discovered yet?

Thanks!

Avatar
neilcreagh

Community Member, 107 Posts

30 March 2013 at 1:42am

Bump. Anyone got any answer for this?

Avatar
neilcreagh

Community Member, 107 Posts

16 October 2013 at 6:40am

Anyone got any answer for this in 3.1?

Avatar
zenmonkey

Community Member, 541 Posts

16 October 2013 at 7:33am

Use setRows()

HTMLEditorField::create('FieldName')->setRows(4);

Avatar
neilcreagh

Community Member, 107 Posts

16 October 2013 at 8:51am

Thanks for the reply - but struggling with this a little.
How would it be applied to this CMS field?

$fields->addFieldToTab('Root.OtherDetails', new HTMLEditorField('ContactBox', 'Contact Box'));

Thanks!

Avatar
neilcreagh

Community Member, 107 Posts

26 February 2014 at 1:12am

To answer my own question here, in case anyone else was struggling with it:

$myHTMLfield = new HTMLEditorField('FieldName', 'Title for this Field');
$myHTMLfield->setRows(4);
 		
$fields->addFieldToTab('Root.Main', $myHTMLfield, '');

Avatar
NickJacobs

Community Member, 148 Posts

12 June 2015 at 9:57am

Or:

$fields->addFieldToTab("Root.Main", HtmlEditorField::create("FieldName", "Field title")->setRows(4));

Avatar
neilcreagh

Community Member, 107 Posts

20 June 2015 at 4:30am

Much better - thanks