You are here

public function FlagAccessCheck::access in Flag 8.4

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/FlagAccessCheck.php, line 48

Class

FlagAccessCheck
Provides routes with the ability to check access to the 'flag' action.

Namespace

Drupal\flag\Access

Code

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);
}