You are here

function hierarchical_select_admin_import_validate in Hierarchical Select 5.3

Same name and namespace in other branches
  1. 6.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 201
Module settings and configuration administration UI.

Code

function hierarchical_select_admin_import_validate($form_id, $form_values, $form) {
  ob_start();
  eval($form_values['config']);
  ob_end_clean();
  form_set_value($form['interpreted_config'], serialize($config));
  if (empty($form_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.'));
  }
}