public function UnFlagListsAccessCheck::access in Flag Lists 8
Same name and namespace in other branches
- 4.0.x src/Access/UnFlagListsAccessCheck.php \Drupal\flag_lists\Access\UnFlagListsAccessCheck::access()
Checks access to the 'unflag' 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/ UnFlagListsAccessCheck.php, line 48
Class
- UnFlagListsAccessCheck
- Provides routes with the ability to check access to the 'unflag' 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('unflag', $account, $flaggable);
}