class RobotAccessController
Same name in other branches
- 3.x modules/config_entity_example/src/RobotAccessController.php \Drupal\config_entity_example\RobotAccessController
- 4.0.x modules/config_entity_example/src/RobotAccessController.php \Drupal\config_entity_example\RobotAccessController
Defines an access controller for the robot entity.
We set this class to be the access controller in Robot's entity annotation.
Hierarchy
- class \Drupal\config_entity_example\RobotAccessController extends \Drupal\Core\Entity\EntityAccessControlHandler
Expanded class hierarchy of RobotAccessController
See also
\Drupal\config_entity_example\Entity\Robot
Related topics
File
-
config_entity_example/
src/ RobotAccessController.php, line 19
Namespace
Drupal\config_entity_exampleView source
class RobotAccessController extends EntityAccessControlHandler {
/**
* {@inheritdoc}
*/
public function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
// The $opereration parameter tells you what sort of operation access is
// being checked for.
if ($operation == 'view') {
return AccessResult::allowed();
}
// Other than the view operation, we're going to be insanely lax about
// access. Don't try this at home!
return parent::checkAccess($entity, $operation, $account);
}
}