function browsersync_get_setting in Browsersync 8
Same name and namespace in other branches
- 8.2 browsersync.module \browsersync_get_setting()
- 7 browsersync.module \browsersync_get_setting()
Retrieves a setting for the current theme or for a given theme.
Parameters
string $setting_name: The name of the setting to be retrieved.
string $theme: (optional) The name of a given theme. Defaults to the current theme.
Return value
mixed The value of the requested setting.
See also
3 calls to browsersync_get_setting()
- browsersync_css_alter in ./
browsersync.module - Implements hook_css_alter().
- browsersync_form_system_theme_settings_alter in ./
browsersync.module - Implements hook_form_FORM_ID_alter().
- browsersync_page_bottom in ./
browsersync.module - Implements hook_page_bottom().
File
- ./
browsersync.module, line 168 - Code for the Browsersync module.
Code
function browsersync_get_setting($setting_name, $theme = NULL) {
$cache =& drupal_static('theme_get_setting', []);
// If no key is given, use the current theme if we can determine it.
if (!isset($theme)) {
$theme = \Drupal::theme()
->getActiveTheme()
->getName();
}
// Prefix the setting name with the module's namespace.
$setting_name = 'third_party_settings.browsersync.' . $setting_name;
if (empty($cache[$theme])) {
// If the cache has not been filled yet, invoke theme_get_setting to
// retrieve the value. This will populate the cache and make it available
// for subsequent requests.
$setting = theme_get_setting($setting_name, $theme);
}
else {
// Retrieve the value from the cache.
$setting = $cache[$theme]
->get($setting_name);
}
return $setting;
}