Editor can select background color of page

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
carol1988
New Member
New Member
Posts: 2
Joined: Sat May 05, 2018 8:24 am

Editor can select background color of page

Post by carol1988 »

I'm creating a website and I want to give the page editors a dropdown selecting when they are editing a page where they can select the background color of that page. The selections should be : White, Grey, Transparent.

Can I add a dropdown selection in the page editor (TinyMCE).
carol
User avatar
DIGI3
Dev Team Member
Dev Team Member
Posts: 1623
Joined: Wed Feb 25, 2009 4:25 am
Location: Victoria, BC

Re: Editor can select background color of page

Post by DIGI3 »

I'm not sure trying to do it within the wysiwyg content editor is best. There are two easy ways to do what you're wanting:

Use CGContentUtilities. Create a dropdown content block with your colour options and include it in your page template. Assign it to a variable, then use that variable to create a class. something like:

Code: Select all

{$background="{content_module module='CGContentUtils' block='color' label='Choose a background color'}"}
</__body class="{$background}">
OR

Use template inheritance, with three child templates containing just the necessary tag for changing the colour, e.g:

Code: Select all

{extends file='cms_template:YourMasterPageTemplate'}
{block name='bodytag'}
  </__body class="bgGrey">
{/block}
Using template inheritance is probably more efficient, but if you don't want to give editors the ability to change templates then the CGCU option may be better. Note: none of the above code is tested, and isn't complete - just gives you the idea.
Not getting the answer you need? CMSMS support options
Post Reply

Return to “Modules/Add-Ons”