You are here

function configuration_notracking_form_validate in Configuration Management 7

Validation and formatting the values submitted in the form.

3 string references to 'configuration_notracking_form_validate'
configuration_activate_form in ./configuration.admin.inc
Menu Callback Form.
configuration_migrate_form in ./configuration.admin.inc
Menu Callback Form.
configuration_tracking_form in ./configuration.admin.inc
Menu Callback Form.

File

./configuration.admin.inc, line 711

Code

function configuration_notracking_form_validate($form, &$form_state) {
  static $has_checked;

  // Create one array from all the saved values
  $configuration_export = array();
  foreach ($form_state['values'] as $component => $value) {

    // Only grab array values since we set #tree above
    if (is_array($value)) {
      $value['items'] = configuration_dom_decode_options($value['items']);
      foreach ($value['items'] as $config_name => $checked) {
        $configuration_export[$component][$config_name] = $checked ? 1 : 0;
        if (!$has_checked && array_search($config_name, $value['items'])) {
          $has_checked = TRUE;
        }
      }
    }
  }
  if (!$has_checked) {
    form_set_error('packages', t('Please choose at least one configuration.'));
  }
  $form_state['configuration_export'] = $configuration_export;
}