class MediaRouteProvider in Drupal 9
Same name and namespace in other branches
- 8 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 EntityHandlerInterface, EntityRouteProviderInterface
- class \Drupal\Core\Entity\Routing\AdminHtmlRouteProvider
- class \Drupal\media\Routing\MediaRouteProvider
- class \Drupal\Core\Entity\Routing\AdminHtmlRouteProvider
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);
}
}
}