You are here

function styleswitcher_styles_settings in Style Switcher 3.0.x

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

Returns a list of styles with theme-specific settings.

Parameters

string $theme: Name of the theme to get styles settings for.

Return value

array Array which keys are styles machine names and each element is a corresponding array with settings: weight, status and is_default. All settings are optional. See styleswitcher_style_load() for their descriptions.

See also

styleswitcher_style_load()

1 call to styleswitcher_styles_settings()
styleswitcher_style_load_multiple in ./styleswitcher.module
Returns a list of styles.
2 string references to 'styleswitcher_styles_settings'
d7_styleswitcher_styles_settings.yml in migrations/d7_styleswitcher_styles_settings.yml
migrations/d7_styleswitcher_styles_settings.yml
MigrateVariablesTest::testMigrationWithUnsetVariables in tests/src/Kernel/Migrate/d7/MigrateVariablesTest.php
Tests migration with unset variables.

File

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

Code

function styleswitcher_styles_settings($theme) {
  $settings = Drupal::config('styleswitcher.styles_settings')
    ->get('settings') ?? [];
  if (empty($settings[$theme])) {
    $settings[$theme] = [];
    styleswitcher_theme_styles($theme);

    // Disable the blank style if theme has its own default one.
    if (styleswitcher_theme_default_style_key($theme)) {
      $settings[$theme]['custom/default']['status'] = FALSE;
    }
  }
  return $settings[$theme];
}