biffbangpow/silverstripe-element-colour

Adds a selector to elements to allow simple styling via the CMS

Installs: 19

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 4

Forks: 0

Open Issues: 0

Type:silverstripe-vendormodule

v1.0.1-beta 2023-05-24 14:35 UTC

This package is auto-updated.

Last update: 2024-03-24 16:29:12 UTC


README

Adds a simple selector to allow CMS editors to apply CSS classes to specific elements.

By default, the extension is applied to all elements when installed. It can be disabled on a per-element class basis, via yml

If the default ElementHolder template has been overridden, it needs to contain the '$VariantStyle' tag in order for this extension to work.

CSS classes are defined in yml, in a simple array which contains the classname and a friendly name for the CSS, eg:

BiffBangPow\Extension\ElementColourExtension:
  element_styles:
    "light": "Light"
    "dark": "Dark"
    "white": "White"
    "darkblue": "Dark Blue"

By default, all elements will use the styles defined by the main yml config. If required, the styles can be overridden at the element class level, making it possible to have different style options on different types of element, eg:

BiffBangPow\Element\VideoHeroElement:
    inherit_config: false
    element_styles:
        "text-white": "White Text"
        "text-black": "Black Text"
        "text-primary": "Pink Text"

Note: the extension does NOT add any actual CSS for the colours. That should be done in the application / project styles