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

Font Color in CMS


Go to End


5 Posts   6759 Views

Avatar
goodness

Community Member, 38 Posts

17 April 2013 at 4:16am

Edited: 17/04/2013 4:19am

I am running SilverStripe 3.0.5 and don't see any way to select a different font color within the CMS.
Even if I bring up the HTML Source Editor and hand code the font color, it doesn't take.

This seems like it should just be a default option in the CMS editor.

I attached an image showing what is presented for editing in the CMS.

Thanks!

Attached Files
Avatar
Optic Blaze

Community Member, 190 Posts

17 April 2013 at 10:01am

Edited: 17/04/2013 10:02am

Hello...me again.

Silverstripe works on the basis that the developer styles the design of fonts etc in the .css files. You would therefore set the colours for your <p> and H1->H6 tags etc in the typography.css file. We don't really encourage changing font colours on the fly, because you might have a lovely design and then a content editor messes it up by using some awful coloured text. You will also notice that unlike other CMS's you cant change the font faces in the CMS either...for the same reason.

That being said, if it is critical to the design of your site that users be able to do that...you can extend the TINMCE interface to allow making changes to fonts and colours...this hower will require some coding.

Go to your _config.php file and add the following code:

// Enable text colour in the CMS
HtmlEditorConfig::get('cms')->insertButtonsAfter('strikethrough', 'forecolor');

here is a article on it:
http://www.ssbits.com/tutorials/2009/customising-the-wysywig-editor-in-v2-3-2-tinymce/

Avatar
goodness

Community Member, 38 Posts

18 April 2013 at 7:18am

Thanks!

I inserted this line of code like you said:

// Enable text colour in the CMS
HtmlEditorConfig::get('cms')->insertButtonsAfter('strikethrough', 'forecolor');

and the options showed up in the editor.

If I ever want to remove them I'm assuming I would just remove the code and then run dev/build.

Avatar
Optic Blaze

Community Member, 190 Posts

18 April 2013 at 8:34am

Yes that is correct. But there is alot more that you can do with the TinyMCE Editor and lots of ways you can extend the functions that it has in the CMS

Have a look at this: http://www.tinymce.com/tryit/full.php

This will give you an idea of all the other plugins/buttons that you can add to the Silverstripe CMS if you want to

Avatar
secuaz

Community Member, 24 Posts

14 May 2013 at 1:13am

Hi all I have the same problem but need to add a dropdown to select the font family. I have not been successful finding that dropdown.
HtmlEditorConfig::get('cms')->insertButtonsAfter('formatselect', '????');

What would i have to add to this???

Thank youu!!!