function skinr_context_ui_group_status_set in Skinr 7.2
Same name and namespace in other branches
- 8.2 skinr_context/skinr_context_ui.admin.inc \skinr_context_ui_group_status_set()
Menu callback; Updates the skin configuration group's status.
1 string reference to 'skinr_context_ui_group_status_set'
- skinr_context_ui_menu in skinr_context/
skinr_context_ui.module - Implements hook_menu().
File
- skinr_context/
skinr_context_ui.admin.inc, line 486 - Admin page callbacks for the Skinr Context UI module.
Code
function skinr_context_ui_group_status_set($group, $status) {
// We require a token in the query string to prevent CSFR attacks.
if (!isset($_GET['token']) || !drupal_valid_token($_GET['token'], 'admin/structure/skinr/group/' . $group->gid . '/' . ($status ? 'enable' : 'disable'))) {
return MENU_ACCESS_DENIED;
}
// Load an uncached version of the skin configuration object.
$group = skinr_context_group_load_unchanged($group->gid);
// Let's save some time in skinr_context_group_save() by setting
// $group->original here.
$group->original = clone $group;
// Update the status and save the skin configuration.
$group->status = $status ? 1 : 0;
skinr_context_group_save($group);
// Some modules may prevent enabling a group in some cases. So check for it.
if ($group->status == $status) {
if ($status) {
drupal_set_message(t('Skin configuration group has been enabled.'));
}
else {
drupal_set_message(t('Skin configuration group has been disabled.'));
}
}
else {
drupal_set_message(t('Changing skin configuration group status failed.'), 'warning');
}
// Return to the skin configuration group overview page.
drupal_goto('admin/structure/skinr/list/groups');
}