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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Multi-line plain text field


Go to End


3 Posts   2448 Views

Avatar
onion

Community Member, 10 Posts

7 February 2012 at 11:52pm

Hi, I want my pages to be as easy as possible to edit in the CMS, and so I've stripped out many of the formatting options in the HTML Editor Field eg:

HtmlEditorConfig::get('cms')->disablePlugins('table', 'contextmenu');
HtmlEditorConfig::get('cms')->setButtonsForLine(1, 'bold','italic','underline','separator', 'formatselect','separator', 'sslink','unlink', pastetext', 'pasteword', 'separator','bullist','numlist','hr','charmap' );
HtmlEditorConfig::get('cms')->setButtonsForLine(2);
HtmlEditorConfig::get('cms')->setButtonsForLine(3);

But in some cases I want to restrict this even more and just want a multi-line plain text field, with absolutely no chance of any formatting added. TextField is fine, but I want my editor to be able to add linebreaks. Is this possible?

Avatar
Devlin

Community Member, 344 Posts

8 February 2012 at 3:00am

new TextareaField(); // plain simple textarea field

Avatar
onion

Community Member, 10 Posts

8 February 2012 at 3:35am

Awesome, thanks! This wasn't in the tutorial so didn't know it existed. Brilliant!