You are here

class RouteSubscriber in Lightning Workflow 8.3

Same name and namespace in other branches
  1. 8 src/Routing/RouteSubscriber.php \Drupal\lightning_workflow\Routing\RouteSubscriber
  2. 8.2 src/Routing/RouteSubscriber.php \Drupal\lightning_workflow\Routing\RouteSubscriber

Reacts to routing events.

@internal This is an internal part of Lightning Workflow's integration with Panelizer and may be changed or removed at any time. External code should not use or extend this class in any way!

Hierarchy

  • class \Drupal\Core\Routing\RouteSubscriberBase implements \Symfony\Component\EventDispatcher\EventSubscriberInterface

Expanded class hierarchy of RouteSubscriber

1 string reference to 'RouteSubscriber'
lightning_workflow.services.yml in ./lightning_workflow.services.yml
lightning_workflow.services.yml
1 service uses RouteSubscriber
lightning_workflow.route_subscriber in ./lightning_workflow.services.yml
\Drupal\lightning_workflow\Routing\RouteSubscriber

File

src/Routing/RouteSubscriber.php, line 17

Namespace

Drupal\lightning_workflow\Routing
View source
class RouteSubscriber extends RouteSubscriberBase {

  /**
   * {@inheritdoc}
   */
  protected function alterRoutes(RouteCollection $collection) {
    $route = $collection
      ->get('panelizer.panels_ipe.revert_to_default');
    if ($route) {
      $route
        ->setDefault('_controller', PanelizerIPEController::class . '::revertToDefault');
    }

    // Ensure that certain routes use the latest revision, rather than the
    // default revision. This can be removed when
    // https://www.drupal.org/project/drupal/issues/2815221 is in core.
    $load_latest_revision = function ($route) use ($collection) {
      $route = $collection
        ->get($route);
      if ($route) {
        $parameters = $route
          ->getOption('parameters');
        $parameters['entity']['load_latest_revision'] = TRUE;
        $route
          ->setOption('parameters', $parameters);
      }
    };
    $load_latest_revision('editor.field_untransformed_text');
    $load_latest_revision('image.upload');
    $load_latest_revision('image.info');
    $load_latest_revision('quickedit.field_form');
  }

}

Members

Namesort descending Modifiers Type Description Overrides
RouteSubscriber::alterRoutes protected function Alters existing routes for a specific collection. Overrides RouteSubscriberBase::alterRoutes
RouteSubscriberBase::getSubscribedEvents public static function Returns an array of event names this subscriber wants to listen to. 5
RouteSubscriberBase::onAlterRoutes public function Delegates the route altering to self::alterRoutes(). 1