Commit 0453593c authored by alexpott's avatar alexpott

Issue #2028585 followup by tim.plunkett: Replace entity_page_create_access()...

Issue #2028585 followup by tim.plunkett: Replace entity_page_create_access() by an access controller.
parent 54e9f29c
......@@ -23,6 +23,13 @@ class EntityCreateAccessCheck implements AccessCheckInterface {
*/
protected $entityManager;
/**
* The key used by the routing requirement.
*
* @var string
*/
protected $requirementsKey = '_entity_create_access';
/**
* Constructs a EntityCreateAccessCheck object.
*
......@@ -37,14 +44,14 @@ public function __construct(EntityManager $entity_manager) {
* {@inheritdoc}
*/
public function applies(Route $route) {
return array_key_exists('_entity_create_access', $route->getRequirements());
return array_key_exists($this->requirementsKey, $route->getRequirements());
}
/**
* {@inheritdoc}
*/
public function access(Route $route, Request $request) {
list($entity_type, $bundle) = explode(':', $route->getRequirement('_entity_create_access') . ':');
list($entity_type, $bundle) = explode(':', $route->getRequirement($this->requirementsKey) . ':');
$definition = $this->entityManager->getDefinition($entity_type);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment