function groupmenu_install in Group Menu 7
Implements hook_install().
File
- ./
groupmenu.install, line 81 - Install, update and uninstall functions for the groupmenu module.
Code
function groupmenu_install() {
$t = get_t();
$node_types = node_type_get_types();
$group_content_types = array();
foreach ($node_types as $type) {
variable_set('groupmenu_enable_' . $type->type, TRUE);
$group_content_types[$type->type] = $type->name;
}
if (!empty($group_content_types)) {
drupal_set_message($t("This update has enabled Group Menu functionality for the following group content types: %types. You can manually disable this on the %ctypes settings page.", array(
'%types' => implode(', ', $group_content_types),
'%ctypes' => l($t('content types'), 'admin/structure/types'),
)));
}
$updated = db_update('system')
->fields(array(
'weight' => 2,
))
->condition('name', 'groupmenu')
->condition('type', 'module')
->execute();
if ($updated == 1) {
return $t('The Group Menu module successfully made it\'s system table update.');
}
else {
throw new DrupalUpdateException('The Group Menu module failed making it\'s system table update. You should apply this manually');
}
}