You are here

function configuration_notracking_form in Configuration Management 7

Menu Callback Form.

1 string reference to 'configuration_notracking_form'
configuration_menu in ./configuration.module
Implements hook_menu().

File

./configuration.admin.inc, line 163

Code

function configuration_notracking_form($form, &$form_state) {
  if (variable_get('remote_server', 0) > 0) {
    drupal_set_message(t('This is a remote server. You are not able to track new configurations on a remote server. !link', array(
      '!link' => l(t('Disable remote server setting.'), 'admin/config/system/configuration/settings'),
    )), 'warning');
  }
  module_load_include('inc', 'configuration', 'configuration.export');
  configuration_include();
  $form['packages'] = array(
    '#type' => 'vertical_tabs',
  );
  $form['#attached']['css'] = array(
    drupal_get_path('module', 'configuration') . '/theme/configuration.css',
  );
  $config = configuration_get_configuration();
  $components = configuration_get_components();
  ksort($components);
  $js_settings = array();
  foreach ($components as $component => $component_info) {
    $options = configuration_invoke($component, 'configuration_export_options');
    if (is_array($options)) {
      $form[$component] = array(
        '#type' => 'fieldset',
        '#group' => 'packages',
        '#title' => check_plain($component_info['name']),
        '#description' => t('Choose the %config_type configurations that you would like to track.', array(
          '%config_type' => $component_info['name'],
        )),
        '#collapsible' => TRUE,
        '#collapsed' => TRUE,
        '#tree' => TRUE,
        '#attached' => array(
          'js' => array(
            'vertical-tabs' => drupal_get_path('module', 'configuration') . '/theme/vertical-tabs.js',
          ),
        ),
      );
      $has_items = FALSE;
      $items = $noactive_items = array();
      foreach ($options as $option => $label) {

        // Only show items that are not currently being tracked
        if (!isset($config[$component]) || !in_array($option, array_keys($config[$component]))) {

          // if (!configuration_in_activestore($component, $option)) {
          //   $noactive_items[$option] = array('name' => $option, 'status' => t('Not in Activestore'));
          // }
          // else {
          $items[$option] = array(
            'name' => $label,
            'status' => t('Not Being Tracked'),
          );

          // }
          $has_items = TRUE;
        }
      }
      if (!$has_items) {
        $form[$component]['#description'] = t('You are tracking all exports for this component.');
      }
      $header = array(
        'name' => t('Configuration Name'),
        'status' => t('Status'),
      );
      if ($has_items) {
        $form[$component]['items'] = array(
          '#type' => 'tableselect',
          '#header' => $header,
          '#options' => configuration_dom_encode_options($items + $noactive_items),
          '#attributes' => array(
            'id' => 'configuration-table-select-' . $component,
          ),
        );
      }
    }

    // Set variables in in js for setting the tab summaries
    $js_settings['configuration'][$component] = $component;
  }
  drupal_add_js($js_settings, 'setting');
  $form['buttons'] = array(
    '#theme' => 'configuration_form_buttons',
    '#tree' => FALSE,
  );
  if (variable_get('remote_server', 0) < 1) {
    $form['buttons']['submit'] = array(
      '#type' => 'submit',
      '#value' => t('Write to Datastore'),
      '#weight' => 10,
    );
  }
  return $form;
}