You are here

function configuration_ui_configuration_list in Configuration Management 7.2

Helper function for configuration lists.

3 calls to configuration_ui_configuration_list()
configuration_ui_export_form in ui/configuration_ui.admin.inc
configuration_ui_notracking_form in ui/configuration_ui.admin.inc
Menu Callback Form.
configuration_ui_tracking_form in ui/configuration_ui.admin.inc

File

ui/configuration_ui.admin.inc, line 119
User interface functions for Configuration Management.

Code

function configuration_ui_configuration_list($ui, $configurations, &$form, &$form_state) {
  $component_exists = FALSE;
  $handlers = configuration_configuration_handlers();
  $form['packages'] = array(
    '#type' => 'vertical_tabs',
  );
  $form['#attached']['css'] = array(
    drupal_get_path('module', 'configuration_ui') . '/theme/configuration.css',
  );
  $form['#attached']['js'] = array(
    drupal_get_path('module', 'configuration_ui') . '/js/configuration_ui.js',
  );
  $form_state['component_exists'] = FALSE;
  foreach ($configurations as $component => $list) {
    $handler = ConfigurationManagement::getConfigurationHandler($component);
    if (empty($handler) || count($list) < 1) {
      continue;
    }
    $form[$component] = array(
      '#type' => 'fieldset',
      '#group' => 'packages',
      '#title' => check_plain($handler::getComponentHumanName($component)),
      '#description' => '<span class= "component" rel="' . check_plain($component) . '">' . t('Configurations for: @component', array(
        '@component' => $handler::getComponentHumanName($component, TRUE),
      )) . '</span>',
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
      '#tree' => TRUE,
      '#attached' => array(
        'js' => array(
          'vertical-tabs' => drupal_get_path('module', 'configuration_ui') . '/theme/vertical-tabs.js',
        ),
      ),
      '#attributes' => array(
        'class' => array(
          'configuration',
        ),
      ),
    );
    $form[$component]['configurations'] = array(
      '#tree' => FALSE,
      '#theme' => 'configuration_table',
      'items' => array(
        '#tree' => TRUE,
      ),
      'name' => array(
        '#tree' => TRUE,
      ),
      'status' => array(
        '#tree' => TRUE,
      ),
      'operations' => array(
        '#tree' => TRUE,
      ),
    );
    $form[$component]['configurations']['#header'] = $form_state['table_header'];
    foreach ($list as $identifier => $info) {
      $form_state['component_exists'] = TRUE;
      $id = $component . '.' . $identifier;
      $form[$component]['configurations']['items'][$id] = array(
        '#type' => 'checkbox',
        '#title' => check_plain($info['name']),
        '#title_display' => 'invisible',
        '#return_value' => $id,
      );
      $form[$component]['configurations']['names'][$id] = array(
        '#markup' => check_plain($info['name']),
      );
      if ($ui == 'tracking') {
        $form[$component]['configurations']['status'][$id] = array(
          '#markup' => '<span class ="config-status" rel="' . $id . '">' . t('Processing...') . '</span>',
        );
      }
      elseif ($ui == 'export') {
        $form[$component]['configurations']['status'][$id] = array(
          '#markup' => $info['hash'] ? t('Tracked') : t('Not tracked'),
        );
      }
      $form[$component]['configurations']['operations'][$id] = array(
        '#markup' => configurations_ui_operations_helper($ui, $id),
      );
    }
    asort($form[$component]['configurations']['items']);
  }
  if (!empty($form_state['component_exists'])) {
    $form['dependencies_option'] = array(
      '#type' => 'fieldset',
      '#title' => t('Dependencies and Optionals'),
      '#description' => t('Choose if you want to process dependent and optional components.'),
      '#collapsible' => TRUE,
      '#collapsed' => FALSE,
    );
    $form['dependencies_option']['include_dependencies'] = array(
      '#type' => 'checkbox',
      '#title' => t('Process component dependencies.'),
      '#default_value' => TRUE,
    );
    $form['dependencies_option']['include_optionals'] = array(
      '#type' => 'checkbox',
      '#title' => t('Process component optionals.'),
      '#default_value' => TRUE,
    );
  }
}