function styleswitcher_style_load in Style Switcher 7.2
Same name and namespace in other branches
- 8.2 styleswitcher.module \styleswitcher_style_load()
- 6.2 styleswitcher.module \styleswitcher_style_load()
- 3.0.x styleswitcher.module \styleswitcher_style_load()
Loads a style array by its machine name and a theme name.
Parameters
string $name: Machine name of the style to load.
string $theme: Machine name of the theme to get the style for.
string $type: (optional) Style type: 'theme' or 'custom'. If the type is specified then it will be prefixed with a slash to the $name argument.
Return value
array|false Style array on success or FALSE otherwise. Style is an associative array containing:
- name: Machine name.
- label: Human-readable label.
- path: System or external path to the CSS file.
- weight: Weight of style link in the switch list.
- status: Indicates whether the style is enabled or not.
- is_default: Indicates that this style is the default one. This element may not always show the truth. It is recommended to use styleswitcher_default_style_key() to get the default style key.
- _i: Index number of the style. It is used for sorting of styles with equal weights.
- theme: Name of the theme the style is loaded for.
See also
styleswitcher_default_style_key()
2 calls to styleswitcher_style_load()
- styleswitcher_active_style_path in ./
styleswitcher.module - Finds the style active for current user and returns its path.
- _styleswitcher_style_exists in ./
styleswitcher.admin.inc - Checks whether a submitted machine name value already exists.
File
- ./
styleswitcher.module, line 345 - Module's hooks implementations and helper functions.
Code
function styleswitcher_style_load($name, $theme, $type = '') {
if ($type) {
$name = $type . '/' . $name;
// The next conversion is only rationale for auto-loader wildcards in paths
// and there are $type arguments always set in menu items so if this
// function is called with only one argument this conversion is redundant.
$name = strtr($name, '-', '_');
}
$styles = styleswitcher_style_load_multiple($theme, array(
'name' => $name,
));
return reset($styles);
}