You are here

function unique_field_form_alter in Unique field 6

Same name and namespace in other branches
  1. 8.2 unique_field.module \unique_field_form_alter()
  2. 8 unique_field.module \unique_field_form_alter()
  3. 5 unique_field.module \unique_field_form_alter()
  4. 7 unique_field.module \unique_field_form_alter()

Implementation of hook_form_alter().

File

./unique_field.module, line 60
Provides content validation requirement that a node's title, author, language, taxonomy terms, or CCK fields are unique.

Code

function unique_field_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id === 'node_type_form' && user_access(UNIQUE_FIELD_PERM_ADMIN) && isset($form['#node_type'])) {
    unique_field_node_settings_form($form);
  }
  elseif (strpos($form_id, 'node_form') !== FALSE && user_access(UNIQUE_FIELD_PERM_BYPASS)) {
    $form['unique_field_override'] = array(
      '#type' => 'hidden',
      '#default_value' => '0',
    );
  }
}