function context_reaction_addassets_base::execute in Context Add Assets 7
Same name and namespace in other branches
- 6 plugins/context_reaction_addassets_base.inc \context_reaction_addassets_base::execute()
Implementation of the built-in context plugin class execution
File
- plugins/
context_reaction_addassets_base.inc, line 104 - The Context reaction plugin to add asset files
Class
- context_reaction_addassets_base
- Expose themes as context reactions.
Code
function execute() {
$contexts = context_active_contexts();
$classes = array();
//dpm($contexts);
foreach ($contexts as $key => $value) {
if (!empty($value->reactions[$this->plugin])) {
foreach ($value->reactions[$this->plugin] as $path_array) {
if (is_array($path_array)) {
foreach ($path_array as $path) {
if ($path) {
$ext = explode('.', $path);
$ext = drupal_strtolower($ext[count($ext) - 1]);
switch ($ext) {
case 'js':
drupal_add_js($path, array(
'group' => JS_DEFAULT,
));
break;
case 'css':
case 'less':
case 'sass':
case 'scss':
drupal_add_css($path, array(
'group' => CSS_THEME,
));
break;
}
}
}
}
}
}
}
}