RouteSubscriber.php in Bibliography & Citation 2.0.x
File
modules/bibcite_entity/src/Routing/RouteSubscriber.php
View source
<?php
namespace Drupal\bibcite_entity\Routing;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Routing\RouteSubscriberBase;
use Symfony\Component\Routing\RouteCollection;
class RouteSubscriber extends RouteSubscriberBase {
protected $configFactory;
public function __construct(ConfigFactoryInterface $config_factory) {
$this->configFactory = $config_factory;
}
protected function alterRoutes(RouteCollection $collection) {
if ($route = $collection
->get('entity.bibcite_reference.revision')) {
$route
->setDefault('_controller', '\\Drupal\\bibcite_entity\\Controller\\ReferenceViewController::viewRevision');
$route
->setDefault('_title_callback', '\\Drupal\\bibcite_entity\\Controller\\ReferenceViewController::revisionTitle');
}
if ($route = $collection
->get('entity.bibcite_reference.canonical')) {
$config = $this->configFactory
->get('bibcite_entity.reference.settings');
$view_mode = $config
->get('display_override.reference_page_view_mode');
$route
->setDefault('_entity_view', 'bibcite_reference.' . $view_mode);
$route
->setDefault('_controller', '\\Drupal\\bibcite_entity\\Controller\\ReferenceViewController::view');
}
if ($route = $collection
->get('entity.bibcite_reference.version_history')) {
$route
->setOption('_admin_route', TRUE);
}
if ($route = $collection
->get('entity.bibcite_reference.revision_revert_form')) {
$route
->setOption('_admin_route', TRUE);
}
if ($route = $collection
->get('bibcite_reference.revision_delete_confirm')) {
$route
->setOption('_admin_route', TRUE);
}
}
}