function _environment_indicator_parse_style in Environment Indicator 4.x
Same name and namespace in other branches
- 8.3 environment_indicator.module \_environment_indicator_parse_style()
Helper function that takes a styles string and parses the individual items.
Parameters
string $style: The style string for the HTML element.
Return value
array An structured array with key value pairs with the CSS properties and their values.
1 call to _environment_indicator_parse_style()
- template_preprocess_environment_indicator in ./
environment_indicator.module - Prepares variables for environment indicator element templates.
File
- ./
environment_indicator.module, line 169 - Module implementation file.
Code
function _environment_indicator_parse_style($style) {
$structured_styles = [];
// Get every individual style.
$styles = array_filter(explode(';', $style));
foreach ($styles as $item) {
list($item_name, $item_value) = explode(':', $item);
trim($item_name);
trim($item_value);
$structured_styles[$item_name] = $item_value;
}
return $structured_styles;
}