You are here

function context_prefix_form_validate in Context 5

Validation handler for context_prefix_form().

File

context_prefix/context_prefix.module, line 812

Code

function context_prefix_form_validate($form) {
  $definition = array(
    'provider' => $form['provider']['#value'],
    'prefix' => $form['prefix']['#value'],
    'id' => $form['id']['#value'],
  );
  if (!context_prefix_api('validate', $definition)) {
    form_set_error($form['#parents'][0], t('There was an error registering the prefix "@prefix". It is either invalid or is already taken. Please choose another.', array(
      '@prefix' => $form['prefix']['#value'],
    )));
    return false;
  }
  else {
    return true;
  }
}