function onlyone_entity_type_alter in Allow a content type only once (Only One) 8
Implements hook_entity_type_alter().
File
- ./
onlyone.module, line 227 - Contains onlyone.module.
Code
function onlyone_entity_type_alter(array &$entity_types) {
// Adding the constraint. Here is not possible to check specific content type.
// @see https://drupal.stackexchange.com/q/208283/28275
if (isset($entity_types['node'])) {
$entity_types['node']
->addConstraint('OnlyOne');
}
}