private function EntityTreeBuilder::hasAccess in Entity Reference Tree Widget 8
Same name and namespace in other branches
- 2.x src/Tree/EntityTreeBuilder.php \Drupal\entity_reference_tree\Tree\EntityTreeBuilder::hasAccess()
Check if a user has the access to the tree.
Parameters
\Drupal\Core\Session\AccountProxyInterface $user: The user object to check.
Return value
bool If the user has the access to the tree return TRUE, otherwise return FALSE.
1 call to EntityTreeBuilder::hasAccess()
- EntityTreeBuilder::loadTree in src/
Tree/ EntityTreeBuilder.php - Load all entities from an entity bundle for the tree.
File
- src/
Tree/ EntityTreeBuilder.php, line 146
Class
- EntityTreeBuilder
- Provides a class for building a tree from general entity.
Namespace
Drupal\entity_reference_tree\TreeCode
private function hasAccess(AccountProxyInterface $user = NULL) {
// Check current user as default.
if (empty($user)) {
$user = \Drupal::currentUser();
}
return $user
->hasPermission($this->accessPermission);
}