function smart_date_entity_access in Smart Date 3.1.x
Same name and namespace in other branches
- 8.2 smart_date.module \smart_date_entity_access()
- 8 smart_date.module \smart_date_entity_access()
- 3.x smart_date.module \smart_date_entity_access()
- 3.0.x smart_date.module \smart_date_entity_access()
- 3.2.x smart_date.module \smart_date_entity_access()
- 3.3.x smart_date.module \smart_date_entity_access()
- 3.4.x smart_date.module \smart_date_entity_access()
Implements hook_entity_access().
Prevent deletion of the default configuration.
File
- ./
smart_date.module, line 49 - Field hooks for a field that stores a start and end date as timestamps.
Code
function smart_date_entity_access($entity, $operation, $account) {
$info = $entity
->getEntityType();
if ($info
->id() == 'smart_date_format') {
if ($entity
->id() == 'default' && $operation == 'delete') {
return AccessResult::forbidden();
}
else {
return AccessResult::neutral();
}
}
}