3 namespace Drupal\{{ machine_name }}\Access;
5 use Drupal\Core\Access\AccessResult;
6 use Drupal\Core\Routing\Access\AccessInterface;
7 use Symfony\Component\Routing\Route;
10 * Checks if passed parameter matches the route configuration.
13 * To make use of this access checker add '{{ applies_to }}: Some value' entry to route
14 * definition under requirements section.
16 class {{ class }} implements AccessInterface {
21 * @param \Symfony\Component\Routing\Route $route
22 * The route to check against.
23 * @param \ExampleInterface $parameter
24 * The parameter to test.
26 * @return \Drupal\Core\Access\AccessResultInterface
29 public function access(Route $route, \ExampleInterface $parameter) {
30 return AccessResult::allowedIf($parameter->getSomeValue() == $route->getRequirement('{{ applies_to }}'));