function contextual_view_modes_update_7300 in Contextual View Modes 7.3
Change the global contextual view mode settings in to a real context reaction on the contexts they were set to.
File
- ./
contextual_view_modes.install, line 125
Code
function contextual_view_modes_update_7300(&$sandbox) {
// Get the settings from the previous version.
$settings = variable_get("contextual_view_modes_global", array());
if (empty($settings)) {
return;
}
// Loop through the settings and attach them to a context.
foreach ($settings as $entity_type => $more) {
foreach ($more as $delta => $variables) {
$context = context_load($variables['context']);
$context->reactions["context_reaction_view_mode"]["entity_types"][$entity_type][$variables["bundle"]] = $variables["view_mode"];
context_save($context);
}
}
variable_del("contextual_view_modes_global");
}