Last active
November 30, 2019 17:58
-
-
Save cmcintosh/a4af632e8747f4874ad02e3d022ef9ab to your computer and use it in GitHub Desktop.
TempleOfDoomViewsAccess.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @ingroup views_access_plugins | |
* | |
* @ViewsAccess( | |
* id = "temple_of_doom", | |
* title = @Translation("Temple of Doom"), | |
* help = @Translation("No bad guys will enter, only Dr Jones may set foot inside.") | |
* ) | |
*/ | |
class TempleOfDoomViewsAccess extends AccessPluginBase { | |
public function summaryTitle() { | |
return $this->t('This Access Handler has stood guard over the treasure inside the Temple of Doom.'); | |
} | |
public function access(AccountInterface $account) { | |
return $this->templeAccess->isUserTheGatekeeper($account) || $this->templeAccess->isUserTheKeymaster($account); | |
} | |
public function alterRouteDefinition(Route $route) { | |
$route->setRequirement('_custom_access', 'temple_of_doom.access_handler::access'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment