You are here

class PurlContextOutboundRouteProcessor in Persistent URL 8

Hierarchy

Expanded class hierarchy of PurlContextOutboundRouteProcessor

1 string reference to 'PurlContextOutboundRouteProcessor'
purl.services.yml in ./purl.services.yml
purl.services.yml
1 service uses PurlContextOutboundRouteProcessor
purl.outbound_route_processor in ./purl.services.yml
Drupal\purl\RouteProcessor\PurlContextOutboundRouteProcessor

File

src/RouteProcessor/PurlContextOutboundRouteProcessor.php, line 21

Namespace

Drupal\purl\RouteProcessor
View source
class PurlContextOutboundRouteProcessor implements OutboundRouteProcessorInterface, EventSubscriberInterface {

  /**
   * @var MethodPluginManager
   */
  private $manager;

  /**
   * @var ModifierMatchedEvent[]
   */
  private $events = array();
  public function __construct(MethodPluginManager $manager) {
    $this->manager = $manager;
  }
  public function processOutbound($route_name, Route $route, array &$parameters, BubbleableMetadata $bubbleable_metadata = NULL) {
    foreach ($this->events as $event) {
      $method = $this->manager
        ->getMethodPlugin($event
        ->getMethod());
      if ($method instanceof OutboundRouteAlteringInterface) {
        $path = $method
          ->alterOutboundRoute($route_name, $event
          ->getModifier(), $route, $parameters, $bubbleable_metadata);
      }
    }
  }
  public function onModifierMatched(ModifierMatchedEvent $event) {
    $this->events[] = $event;
  }
  public static function getSubscribedEvents() {
    return [
      PurlEvents::MODIFIER_MATCHED => array(
        'onModifierMatched',
        300,
      ),
    ];
  }

}

Members