Skip to content

Add theme hook to set the options in Visual theme (Colourways) field #16

@andybroomfield

Description

@andybroomfield

The sub sites visual theme (colourways) worked at BHCC by adding a class to the body field and the colours handled in the theme stylesheet. Assuming its going to be simmilar for sub sites, that themes need to provide the styles to alter the colour scheme, themes are going to need a way of adding values to this field.
This so is content designers can choose visual themes for the sub site that the theme supports.
My initial suggestion is to provide a theme hook, eg. hook_theme_subsites_visual_theme(&$values) which should provide the an array with the class name and the label for the field colourway_classname => Colour way Labal.
eg.

function localgov_theme_subsites_visual_theme(&$values) {
  $values += [
     'localgov_theme_magenta' => 'Magenta',
     'localgov_theme_cyan' => 'Cyan',
     'localgov_theme_rose' => 'Roase',
  ];
}

Pass by reference so child themes can set there own, or unset previous values.
Eg. for the BHCC Theme.

function localgov_bhcc_theme_subsites_visual_theme(&$values) {
  unset($values['localgov_theme_magenta'];
  $values += [
     'localgov_theme_bhcc_magenta' => 'BHCC Magenta',
     'localgov_theme_bhcc_orange' => 'BHCC Orange',
     'localgov_theme_bhcc_corporate' => 'BHCC Corporate',
  ]; 
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions