You are here

function styleswitcher_custom_styles in Style Switcher 3.0.x

Same name and namespace in other branches
  1. 8.2 styleswitcher.module \styleswitcher_custom_styles()
  2. 6.2 styleswitcher.module \styleswitcher_custom_styles()
  3. 7.2 styleswitcher.module \styleswitcher_custom_styles()

Returns a list of custom styles.

Return value

array Array which keys are styles machine names and each element is a corresponding array with properties: name, label and path. All properties are mandatory. See styleswitcher_style_load() for their descriptions.

See also

styleswitcher_style_load()

4 calls to styleswitcher_custom_styles()
StyleswitcherAdmin::buildForm in src/Form/StyleswitcherAdmin.php
Form constructor.
StyleswitcherStyleDeleteForm::submitForm in src/Form/StyleswitcherStyleDeleteForm.php
Form submission handler.
StyleswitcherStyleForm::submitForm in src/Form/StyleswitcherStyleForm.php
Form submission handler.
styleswitcher_style_load_multiple in ./styleswitcher.module
Returns a list of styles.
1 string reference to 'styleswitcher_custom_styles'
d7_styleswitcher_custom_styles.yml in migrations/d7_styleswitcher_custom_styles.yml
migrations/d7_styleswitcher_custom_styles.yml

File

./styleswitcher.module, line 237
Module's hooks implementations and helper functions.

Code

function styleswitcher_custom_styles() {
  $defaults['custom/default'] = [
    'name' => 'custom/default',
    'label' => 'Default',
    'path' => NULL,
  ];
  $styles = Drupal::config('styleswitcher.custom_styles')
    ->get('styles');
  return $styles ? $styles : $defaults;
}