function unique_field_form_alter in Unique field 8
Same name and namespace in other branches
- 8.2 unique_field.module \unique_field_form_alter()
- 5 unique_field.module \unique_field_form_alter()
- 6 unique_field.module \unique_field_form_alter()
- 7 unique_field.module \unique_field_form_alter()
Implements hook_form_alter().
File
- ./
unique_field.module, line 44
Code
function unique_field_form_alter(&$form, \Drupal\Core\Form\FormStateInterface &$form_state, $form_id) {
if ($form_id === 'node_type_edit_form' && \Drupal::currentUser()
->hasPermission('unique_field_perm_admin') && isset($form['type'])) {
unique_field_node_settings_form($form, $form_state);
}
elseif (strpos($form_id, 'node_form') !== FALSE && \Drupal::currentUser()
->hasPermission('unique_field_perm_bypass')) {
$form['unique_field_override'] = array(
'#type' => 'hidden',
'#default_value' => '0',
);
}
}