class PhotosRouteSubscriber in Album Photos 8.5
Same name and namespace in other branches
- 6.0.x src/Routing/PhotosRouteSubscriber.php \Drupal\photos\Routing\PhotosRouteSubscriber
Listens to the dynamic route events.
Hierarchy
- class \Drupal\Core\Routing\RouteSubscriberBase implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
- class \Drupal\photos\Routing\PhotosRouteSubscriber
Expanded class hierarchy of PhotosRouteSubscriber
1 string reference to 'PhotosRouteSubscriber'
1 service uses PhotosRouteSubscriber
File
- src/
Routing/ PhotosRouteSubscriber.php, line 12
Namespace
Drupal\photos\RoutingView source
class PhotosRouteSubscriber extends RouteSubscriberBase {
/**
* The config factory.
*
* @var \Drupal\Core\Config\ConfigFactoryInterface
*/
protected $configFactory;
/**
* Constructs a new PhotosRouteSubscriber.
*
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The config factory.
*/
public function __construct(ConfigFactoryInterface $config_factory) {
$this->configFactory = $config_factory;
}
/**
* {@inheritdoc}
*/
protected function alterRoutes(RouteCollection $collection) {
if ($this->configFactory
->get('photos.settings')
->get('photos_legacy_view_mode')) {
// An attempt to preserve image layouts configured pre 8.x-5.x.
if ($route = $collection
->get('entity.photos_image.canonical')) {
$route
->setDefault('_controller', '\\Drupal\\photos\\Controller\\PhotosLegacyImageViewController::view');
}
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PhotosRouteSubscriber:: |
protected | property | The config factory. | |
PhotosRouteSubscriber:: |
protected | function |
Alters existing routes for a specific collection. Overrides RouteSubscriberBase:: |
|
PhotosRouteSubscriber:: |
public | function | Constructs a new PhotosRouteSubscriber. | |
RouteSubscriberBase:: |
public static | function | Returns an array of event names this subscriber wants to listen to. | 5 |
RouteSubscriberBase:: |
public | function | Delegates the route altering to self::alterRoutes(). | 1 |