class MediaRouteProvider

Same name in other branches
  1. 9 core/modules/media/src/Routing/MediaRouteProvider.php \Drupal\media\Routing\MediaRouteProvider
  2. 10 core/modules/media/src/Routing/MediaRouteProvider.php \Drupal\media\Routing\MediaRouteProvider
  3. 11.x core/modules/media/src/Routing/MediaRouteProvider.php \Drupal\media\Routing\MediaRouteProvider

Provides HTML routes for media pages.

Hierarchy

Expanded class hierarchy of MediaRouteProvider

File

core/modules/media/src/Routing/MediaRouteProvider.php, line 15

Namespace

Drupal\media\Routing
View source
class MediaRouteProvider extends AdminHtmlRouteProvider {
    
    /**
     * The media settings config.
     *
     * @var \Drupal\Core\Config\ImmutableConfig
     */
    protected $config;
    
    /**
     * {@inheritdoc}
     */
    public function __construct(EntityTypeManagerInterface $entity_type_manager, EntityFieldManagerInterface $entity_field_manager, ConfigFactoryInterface $config_factory) {
        parent::__construct($entity_type_manager, $entity_field_manager);
        $this->config = $config_factory->get('media.settings');
    }
    
    /**
     * {@inheritdoc}
     */
    public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) {
        return new static($container->get('entity_type.manager'), $container->get('entity_field.manager'), $container->get('config.factory'));
    }
    
    /**
     * {@inheritdoc}
     */
    protected function getCanonicalRoute(EntityTypeInterface $entity_type) {
        if ($this->config
            ->get('standalone_url')) {
            return parent::getCanonicalRoute($entity_type);
        }
        else {
            return parent::getEditFormRoute($entity_type);
        }
    }

}

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::getDeleteFormRoute protected function Gets the delete-form route. Overrides DefaultHtmlRouteProvider::getDeleteFormRoute
AdminHtmlRouteProvider::getDeleteMultipleFormRoute protected function Returns the delete multiple form route. Overrides DefaultHtmlRouteProvider::getDeleteMultipleFormRoute
AdminHtmlRouteProvider::getEditFormRoute protected function Gets the edit-form route. Overrides DefaultHtmlRouteProvider::getEditFormRoute 1
DefaultHtmlRouteProvider::$entityFieldManager protected property The entity field manager.
DefaultHtmlRouteProvider::$entityTypeManager protected property The entity type manager.
DefaultHtmlRouteProvider::getCollectionRoute protected function Gets the collection route. 2
DefaultHtmlRouteProvider::getEntityTypeIdKeyType protected function Gets the type of the ID key for a given entity type. 1
DefaultHtmlRouteProvider::getRoutes public function Provides routes for entities. Overrides EntityRouteProviderInterface::getRoutes 1
MediaRouteProvider::$config protected property The media settings config.
MediaRouteProvider::createInstance public static function Instantiates a new instance of this entity handler. Overrides DefaultHtmlRouteProvider::createInstance
MediaRouteProvider::getCanonicalRoute protected function Gets the canonical route. Overrides DefaultHtmlRouteProvider::getCanonicalRoute
MediaRouteProvider::__construct public function Constructs a new DefaultHtmlRouteProvider. Overrides DefaultHtmlRouteProvider::__construct

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