class MediaRouteProvider
Same name in other branches
- 9 core/modules/media/src/Routing/MediaRouteProvider.php \Drupal\media\Routing\MediaRouteProvider
- 8.9.x core/modules/media/src/Routing/MediaRouteProvider.php \Drupal\media\Routing\MediaRouteProvider
- 10 core/modules/media/src/Routing/MediaRouteProvider.php \Drupal\media\Routing\MediaRouteProvider
Provides HTML routes for media pages.
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\media\Routing\MediaRouteProvider extends \Drupal\Core\Entity\Routing\AdminHtmlRouteProvider
- class \Drupal\Core\Entity\Routing\AdminHtmlRouteProvider extends \Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider
Expanded class hierarchy of MediaRouteProvider
File
-
core/
modules/ media/ src/ Routing/ MediaRouteProvider.php, line 15
Namespace
Drupal\media\RoutingView 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
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.