protected function MenuTreeResource::addAccess in REST Menu Tree 8
Same name and namespace in other branches
- 2.x src/Plugin/rest/resource/MenuTreeResource.php \Drupal\rest_menu_tree\Plugin\rest\resource\MenuTreeResource::addAccess()
Add Access.
Ensure that every item has an access result, if possible.
1 call to MenuTreeResource::addAccess()
- MenuTreeResource::get in src/
Plugin/ rest/ resource/ MenuTreeResource.php
File
- src/
Plugin/ rest/ resource/ MenuTreeResource.php, line 141
Class
- MenuTreeResource
- Provides a resource to get view modes by entity and bundle.
Namespace
Drupal\rest_menu_tree\Plugin\rest\resourceCode
protected function addAccess(array $data) {
foreach ($data as $value) {
if ($value->access === NULL && $value->link instanceof AccessibleInterface) {
$value->access = $value->link
->access('view', NULL, TRUE);
}
if ($value->subtree) {
$this
->addAccess($value->subtree);
}
}
}