class ContentLockRoutes in Content locking (anti-concurrent editing) 8
Same name and namespace in other branches
- 8.2 src/Routing/ContentLockRoutes.php \Drupal\content_lock\Routing\ContentLockRoutes
Class ContentLockRoutes.
@package Drupal\content_lock\Routing
Hierarchy
- class \Drupal\content_lock\Routing\ContentLockRoutes implements ContainerInjectionInterface
Expanded class hierarchy of ContentLockRoutes
File
- src/
Routing/ ContentLockRoutes.php, line 16
Namespace
Drupal\content_lock\RoutingView source
class ContentLockRoutes implements ContainerInjectionInterface {
protected $entityTypeManager;
/**
* {@inheritdoc}
*/
public function __construct(EntityTypeManagerInterface $entityTypeManager) {
$this->entityTypeManager = $entityTypeManager;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static($container
->get('entity_type.manager'));
}
/**
* {@inheritdoc}
*/
public function routes() {
$routes = [];
$definitions = $this->entityTypeManager
->getDefinitions();
foreach ($definitions as $definition) {
if ($definition instanceof ContentEntityTypeInterface) {
$routes['content_lock.break_lock.' . $definition
->id()] = new Route('/admin/lock/break/' . $definition
->id() . '/{entity}/{langcode}/{form_op}', [
'_form' => $definition
->getHandlerClass('break_lock_form'),
'_title' => 'Break lock',
], [
'_custom_access' => $definition
->getHandlerClass('break_lock_form') . '::access',
], [
'_admin_route' => TRUE,
'parameters' => [
'entity' => [
'type' => 'entity:' . $definition
->id(),
],
],
]);
$routes['content_lock.create_lock.' . $definition
->id()] = new Route('/admin/lock/create/' . $definition
->id() . '/{entity}/{langcode}/{form_op}', [
'_controller' => '\\Drupal\\content_lock\\Controller\\ContentLockController::createLockCall',
], [
'_custom_access' => '\\Drupal\\content_lock\\Controller\\ContentLockController::access',
], [
'parameters' => [
'entity' => [
'type' => 'entity:' . $definition
->id(),
],
],
]);
}
}
return $routes;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ContentLockRoutes:: |
protected | property | ||
ContentLockRoutes:: |
public static | function |
Instantiates a new instance of this class. Overrides ContainerInjectionInterface:: |
|
ContentLockRoutes:: |
public | function | ||
ContentLockRoutes:: |
public | function |