function unique_field_entity_base_field_info_alter in Unique field 8
Implements hook_entity_base_field_info_alter().
File
- ./
unique_field.module, line 171
Code
function unique_field_entity_base_field_info_alter(&$fields, \Drupal\Core\Entity\EntityTypeInterface $entity_type, $bundle) {
if ($entity_type
->id() == 'node') {
// $node_type = \Drupal\node\Entity\NodeType::load($bundle);
// $selected_fields = $node_type->getThirdPartySetting('unique_field', 'type_fields', '');
// foreach ($selected_fields as $key => $field) {
// if(!empty($fields[$field])) {
// $fields[$field]->addConstraint('UniqueField', []);
// }
// }
}
}