class BlockContentRouteProvider
Provides HTML routes for block_content entities.
Hierarchy
- class \Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider implements \Drupal\Core\Entity\Routing\EntityRouteProviderInterface, \Drupal\Core\Entity\EntityHandlerInterface
- class \Drupal\Core\Entity\Routing\AdminHtmlRouteProvider extends \Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider
- class \Drupal\block_content\Routing\BlockContentRouteProvider extends \Drupal\Core\Entity\Routing\AdminHtmlRouteProvider
- class \Drupal\Core\Entity\Routing\AdminHtmlRouteProvider extends \Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider
Expanded class hierarchy of BlockContentRouteProvider
1 file declares its use of BlockContentRouteProvider
- BlockContent.php in core/
modules/ block_content/ src/ Entity/ BlockContent.php
File
-
core/
modules/ block_content/ src/ Routing/ BlockContentRouteProvider.php, line 13
Namespace
Drupal\block_content\RoutingView source
class BlockContentRouteProvider extends AdminHtmlRouteProvider {
/**
* {@inheritdoc}
*/
public function getRoutes(EntityTypeInterface $entity_type) {
$routes = parent::getRoutes($entity_type);
// Rename the entity.block_content.add_page route to keep BC.
// @todo remove this and use an alias instead when https://www.drupal.org/project/drupal/issues/3506653 is done.
$addPageRoute = $routes->get('entity.block_content.add_page');
$routes->remove('entity.block_content.add_page');
$routes->add('block_content.add_page', $addPageRoute);
return $routes;
}
/**
* {@inheritdoc}
*/
protected function getCanonicalRoute(EntityTypeInterface $entity_type) {
return self::getEditFormRoute($entity_type);
}
/**
* {@inheritdoc}
*/
protected function getEditFormRoute(EntityTypeInterface $entity_type) {
return parent::getEditFormRoute($entity_type)->addRequirements([
'_block_content_reusable' => 'TRUE',
]);
}
/**
* {@inheritdoc}
*/
protected function getDeleteFormRoute(EntityTypeInterface $entity_type) {
return parent::getDeleteFormRoute($entity_type)->addRequirements([
'_block_content_reusable' => 'TRUE',
]);
}
}
Members
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.