function haveNodeAccess in Access by Reference 8
Same name and namespace in other branches
- 8.2 access_by_ref.module \haveNodeAccess()
1 call to haveNodeAccess()
File
- ./
access_by_ref.module, line 11
Code
function haveNodeAccess($target_id, $op, $account) {
$target_node = \Drupal::service('entity_type.manager')
->getStorage('node')
->load($target_id);
if (isset($target_node) && $target_node
->access($op) == 1) {
return $target_node;
}
else {
return false;
}
}