Skip to content
Snippets Groups Projects
Commit 9def98f6 authored by Angie Byron's avatar Angie Byron
Browse files

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

Issue #2061987 by InternetDevels: Replace user_access() calls with ->hasPermission() in field module.
parent d06b4676
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment