function features_cleanup_form in Features 7
Same name and namespace in other branches
- 6 features.admin.inc \features_cleanup_form()
Form for disabling orphaned dependencies.
1 string reference to 'features_cleanup_form'
- features_menu in ./
features.module - Implements hook_menu().
File
- ./
features.admin.inc, line 683 - @todo.
Code
function features_cleanup_form($form, $form_state, $cache_clear = FALSE) {
$form = array();
// Clear caches if we're getting a post-submit redirect that requests it.
if ($cache_clear) {
drupal_flush_all_caches();
// The following functions need to be run because drupal_flush_all_caches()
// runs rebuilds in the wrong order. The node type cache is rebuilt *after*
// the menu is rebuilt, meaning that the menu tree is stale in certain
// circumstances after drupal_flush_all_caches(). We rebuild again.
menu_rebuild();
}
// Retrieve orphaned modules and provide them as optional modules to be disabled.
// Exclude any modules that have been added to the 'ignored' list.
$options = array();
$orphans = features_get_orphans();
$ignored = variable_get('features_ignored_orphans', array());
if (!empty($orphans)) {
foreach ($orphans as $module) {
if (!in_array($module->name, $ignored, TRUE)) {
$options[$module->name] = check_plain($module->info['name']);
}
}
}
if (!empty($options)) {
$form['orphans'] = array(
'#title' => t('Orphaned dependencies'),
'#description' => t('These modules are dependencies of features that have been disabled. They may be disabled without affecting other components of your website.'),
'#type' => 'checkboxes',
'#options' => $options,
'#default_value' => array_keys($options),
);
$form['buttons'] = array(
'#tree' => TRUE,
'#theme' => 'features_form_buttons',
);
$form['buttons']['disable'] = array(
'#type' => 'submit',
'#value' => t('Disable selected modules'),
'#submit' => array(
'features_cleanup_form_disable',
),
);
$form['buttons']['ignore'] = array(
'#type' => 'submit',
'#value' => t('Leave enabled'),
'#submit' => array(
'features_cleanup_form_ignore',
),
);
}
else {
drupal_goto('admin/structure/features');
}
return $form;
}