Commit 9def98f6 authored by webchick's avatar webchick

Issue #2061987 by InternetDevels: Replace user_access() calls with...

Issue #2061987 by InternetDevels: Replace user_access() calls with ->hasPermission() in field module.
parent d06b4676
......@@ -1382,7 +1382,7 @@ function hook_field_storage_purge(\Drupal\Core\Entity\EntityInterface $entity, $
*/
function hook_field_access($op, \Drupal\field\FieldInterface $field, $entity_type, $entity, $account) {
if ($field['field_name'] == 'field_of_interest' && $op == 'edit') {
return user_access('edit field of interest', $account);
return $account->hasPermission('edit field of interest');
}
return TRUE;
}
......
......@@ -208,7 +208,7 @@ function field_test_field_access($op, FieldInterface $field, $entity_type, $enti
// Only grant view access to test_view_field fields when the user has
// 'view test_view_field content' permission.
if ($field['field_name'] == 'test_view_field' && $op == 'view' && !user_access('view test_view_field content')) {
if ($field['field_name'] == 'test_view_field' && $op == 'view' && !$account->hasPermission('view test_view_field content')) {
return FALSE;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment