You are here

function hierarchical_select_admin_import_validate in Hierarchical Select 6.3

Same name and namespace in other branches
  1. 5.3 hierarchical_select.admin.inc \hierarchical_select_admin_import_validate()
  2. 7.3 hierarchical_select.admin.inc \hierarchical_select_admin_import_validate()

Validate callback; config import form.

File

./hierarchical_select.admin.inc, line 205
Module settings and configuration administration UI.

Code

function hierarchical_select_admin_import_validate($form, &$form_state) {
  ob_start();
  eval($form_state['values']['config']);
  ob_end_clean();
  form_set_value($form['interpreted_config'], serialize($config), $form_state);
  if (empty($form_state['values']['config'])) {
    form_error($form['config'], t('You did not enter anything.'));
  }
  elseif ($config == NULL) {
    form_error($form['config'], t('There is a syntax error in the Hierarchical Select configuration you entered.'));
  }
  elseif (!isset($config['config_id']) || empty($config['config_id'])) {
    form_error($form['config'], t('Unable to import this configuration, because no Hierarchical Select <em>config id</em> is set.'));
  }
}