You are here

function xbbcode_custom_tags_validate in Extensible BBCode 8

Same name and namespace in other branches
  1. 5 xbbcode-settings.php \xbbcode_custom_tags_validate()
  2. 6 xbbcode.admin.inc \xbbcode_custom_tags_validate()
  3. 7 xbbcode.admin.inc \xbbcode_custom_tags_validate()

Validation of the custom tags form.

File

./xbbcode.admin.inc, line 198
Administrative interface for modifying tags and settings.

Code

function xbbcode_custom_tags_validate($form, $form_state) {
  if (!preg_match('/^[a-z0-9]*$/i', $form_state['values']['name'])) {
    form_set_error('name', t('The name must be alphanumeric.'));
  }
  if ($form['edit']['name']['#default_value'] != $form_state['values']['name']) {
    if (xbbcode_custom_tag_exists($form_state['values']['name'])) {
      form_set_error('name', t('This name is already taken. Please delete or edit the old tag, or choose a different name.'));
    }
  }
}