You are here

function unique_field_form_alter in Unique field 7

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. 6 unique_field.module \unique_field_form_alter()

Implements hook_form_alter().

File

./unique_field.module, line 62
Provides content validation requirement that a node's author, language, taxonomy terms, or other 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',
    );
  }
}