public function FlagListsAccessCheck::access in Flag Lists 8
Same name and namespace in other branches
- 4.0.x src/Access/FlagListsAccessCheck.php \Drupal\flag_lists\Access\FlagListsAccessCheck::access()
Checks access to the 'flag' action.
Parameters
\Drupal\Core\Routing\RouteMatchInterface $route_match: The parametrized route.
\Drupal\flag\FlagInterface $flag: The flag entity.
\Drupal\Core\Session\AccountInterface $account: The user account.
Return value
string A \Drupal\Core\Access\AccessInterface constant value.
File
- src/
Access/ FlagListsAccessCheck.php, line 48
Class
- FlagListsAccessCheck
- Provides routes with the ability to check access to the 'flag' action.
Namespace
Drupal\flag_lists\AccessCode
public function access(RouteMatchInterface $route_match, FlagInterface $flag, AccountInterface $account) {
$flaggable_id = $route_match
->getParameter('entity_id');
$flaggable = $this->flagService
->getFlaggableById($flag, $flaggable_id);
return $flag
->actionAccess('flag', $account, $flaggable);
}