class BlockContentRouteProvider

Provides HTML routes for block_content entities.

Hierarchy

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\Routing
View 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

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
AdminHtmlRouteProvider::getAddFormRoute protected function Gets the add-form route. Overrides DefaultHtmlRouteProvider::getAddFormRoute
AdminHtmlRouteProvider::getAddPageRoute protected function Gets the add page route. Overrides DefaultHtmlRouteProvider::getAddPageRoute
AdminHtmlRouteProvider::getDeleteMultipleFormRoute protected function Returns the delete multiple form route. Overrides DefaultHtmlRouteProvider::getDeleteMultipleFormRoute
BlockContentRouteProvider::getCanonicalRoute protected function Gets the canonical route. Overrides DefaultHtmlRouteProvider::getCanonicalRoute
BlockContentRouteProvider::getDeleteFormRoute protected function Gets the delete-form route. Overrides AdminHtmlRouteProvider::getDeleteFormRoute
BlockContentRouteProvider::getEditFormRoute protected function Gets the edit-form route. Overrides AdminHtmlRouteProvider::getEditFormRoute
BlockContentRouteProvider::getRoutes public function Provides routes for entities. Overrides DefaultHtmlRouteProvider::getRoutes
DefaultHtmlRouteProvider::$entityFieldManager protected property The entity field manager.
DefaultHtmlRouteProvider::$entityTypeManager protected property The entity type manager.
DefaultHtmlRouteProvider::createInstance public static function Instantiates a new instance of this entity handler. Overrides EntityHandlerInterface::createInstance 1
DefaultHtmlRouteProvider::getCollectionRoute protected function Gets the collection route. 1
DefaultHtmlRouteProvider::getEntityTypeIdKeyType protected function Gets the type of the ID key for a given entity type. 1
DefaultHtmlRouteProvider::__construct public function Constructs a new DefaultHtmlRouteProvider. 1

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