class EntityPermissionsRouteProviderWithCheck

Same name in other branches
  1. 9 core/modules/user/src/Entity/EntityPermissionsRouteProviderWithCheck.php \Drupal\user\Entity\EntityPermissionsRouteProviderWithCheck
  2. 10 core/modules/user/src/Entity/EntityPermissionsRouteProviderWithCheck.php \Drupal\user\Entity\EntityPermissionsRouteProviderWithCheck

Provides routes for the entity permissions form with a custom access check.

Use this class or EntityPermissionsRouteProvider as a route provider for an entity type such as BlockContentType. Either one will provide routes for the entity permissions form. This class provides a custom access check: it denies access if there are no entity-specific permissions. If you know that each entity has permissions, or if the check is too expensive, then use EntityPermissionsRouteProvider instead of this class.

Hierarchy

Expanded class hierarchy of EntityPermissionsRouteProviderWithCheck

Deprecated

in drupal:11.1.0 and is removed from drupal:12.0.0. Use EntityPermissionsRouteProvider instead.

See also

https://www.drupal.org/node/3384745

1 file declares its use of EntityPermissionsRouteProviderWithCheck
EntityPermissionsRouteProviderWithCheckTest.php in core/modules/user/tests/src/Unit/Entity/EntityPermissionsRouteProviderWithCheckTest.php

File

core/modules/user/src/Entity/EntityPermissionsRouteProviderWithCheck.php, line 22

Namespace

Drupal\user\Entity
View source
class EntityPermissionsRouteProviderWithCheck extends EntityPermissionsRouteProvider {
    
    /**
     * {@inheritdoc}
     */
    protected function getEntityPermissionsRoute(EntityTypeInterface $entity_type) : ?Route {
        @trigger_error(__CLASS__ . ' is deprecated in drupal:11.1.0 and is removed from drupal:12.0.0. Use EntityPermissionsRouteProvider instead. See https://www.drupal.org/node/3384745', E_USER_DEPRECATED);
        $route = parent::getEntityPermissionsRoute($entity_type);
        if ($route) {
            $route->setRequirement('_custom_access', '\\Drupal\\user\\Form\\EntityPermissionsForm::access');
        }
        return $route;
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
EntityPermissionsRouteProvider::$entityTypeManager protected property The entity type manager.
EntityPermissionsRouteProvider::createInstance public static function Instantiates a new instance of this entity handler. Overrides EntityHandlerInterface::createInstance
EntityPermissionsRouteProvider::getRoutes public function Provides routes for entities. Overrides EntityRouteProviderInterface::getRoutes
EntityPermissionsRouteProvider::__construct public function Constructs a new EntityPermissionsRouteProvider.
EntityPermissionsRouteProviderWithCheck::getEntityPermissionsRoute protected function Gets the entity permissions route. Overrides EntityPermissionsRouteProvider::getEntityPermissionsRoute

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.