function yoast_seo_entity_field_access in Real-time SEO for Drupal 8.2
Same name and namespace in other branches
- 8 yoast_seo.module \yoast_seo_entity_field_access()
Implements hook_field_access().
File
- ./
yoast_seo.module, line 29 - Contains yoast_seo.module.
Code
function yoast_seo_entity_field_access($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, FieldItemListInterface $items = NULL) {
if ($field_definition
->getType() == 'yoast_seo') {
return AccessResult::forbiddenIf(!($account
->hasPermission('use yoast seo') || $account
->hasPermission('administer yoast seo')) || !($account
->hasPermission('create url aliases') || $account
->hasPermission('administer url aliases')))
->cachePerPermissions();
}
// No opinion.
return AccessResult::neutral();
}