You are here

function configuration_confirm_delete_multiple in Configuration Management 7

Form for deleting configs.

1 call to configuration_confirm_delete_multiple()
configuration_tracking_form in ./configuration.admin.inc
Menu Callback Form.

File

./configuration.admin.inc, line 598

Code

function configuration_confirm_delete_multiple($form, &$form_state) {
  module_load_include('inc', 'configuration', 'configuration.export');
  configuration_include();
  $list_to_delete = array();
  $form['config_name']['#tree'] = TRUE;
  foreach (element_children($form_state['values']) as $component) {
    if (is_array($form_state['values'][$component])) {
      foreach (array_keys(array_filter($form_state['values'][$component]['items'])) as $name) {
        $form['config_name'][$component . ':' . $name] = array(
          '#type' => 'value',
          '#value' => $component . ':' . $name,
        );
        if (!isset($list_to_delete[$component])) {
          $list_to_delete[$component] = array(
            'data' => $component,
            'children' => array(),
          );
        }
        $list_to_delete[$component]['children'][$name] = array(
          'data' => $name,
        );
      }
    }
  }
  $message = t('Are you sure you want to stop tracking configuration for the following configs?');
  $message .= '<p>' . theme('item_list', array(
    'items' => $list_to_delete,
  )) . '</p>';
  $message .= t('This action cannot be undone.');
  $form = confirm_form($form, t('Are you sure you want to stop tracking configuration for the following configs?'), 'admin/config/system/configuration', $message, t('Stop Tracking'), t('Cancel'), 'confirm');
  $form['#submit'][] = 'configuration_confirm_delete_submit';
  return $form;
}