class PurlContextOutboundPathProcessor in Persistent URL 8
Hierarchy
- class \Drupal\purl\PathProcessor\PurlContextOutboundPathProcessor implements \Symfony\Component\EventDispatcher\EventSubscriberInterface, OutboundPathProcessorInterface
Expanded class hierarchy of PurlContextOutboundPathProcessor
1 string reference to 'PurlContextOutboundPathProcessor'
1 service uses PurlContextOutboundPathProcessor
File
- src/
PathProcessor/ PurlContextOutboundPathProcessor.php, line 15
Namespace
Drupal\purl\PathProcessorView source
class PurlContextOutboundPathProcessor implements OutboundPathProcessorInterface, EventSubscriberInterface {
/**
* @var ModifierMatchedEvent[]
*/
protected $events = array();
protected $methodManager;
public function __construct(MethodPluginManager $methodManager) {
$this->methodManager = $methodManager;
}
public function processOutbound($path, &$options = array(), Request $request = NULL, BubbleableMetadata $bubbleable_metadata = NULL) {
if (array_key_exists('purl_context', $options) && $options['purl_context'] == false) {
if (count($this->events) && $bubbleable_metadata) {
$cacheContexts = $bubbleable_metadata
->getCacheContexts();
$cacheContexts[] = 'purl';
$bubbleable_metadata
->setCacheContexts($cacheContexts);
}
foreach ($this->events as $event) {
$path = $this
->exitContext($event, $path, $options);
}
return $path;
}
foreach ($this->events as $event) {
$path = $this
->enterContext($event, $path, $options);
}
return $path;
}
public function exitContext(ModifierMatchedEvent $event, $path, $options) {
$method = $this->methodManager
->getMethodPlugin($event
->getMethod());
$result = $method
->exitContext($event
->getModifier(), $path, $options);
return $result === null ? $path : $result;
}
public function enterContext(ModifierMatchedEvent $event, $path, $options) {
$method = $this->methodManager
->getMethodPlugin($event
->getMethod());
$result = $method
->enterContext($event
->getModifier(), $path, $options);
return $result === null ? $path : $result;
}
public function onModifierMatched(ModifierMatchedEvent $event) {
$this->events[] = $event;
}
public static function getSubscribedEvents() {
return [
PurlEvents::MODIFIER_MATCHED => array(
'onModifierMatched',
300,
),
];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PurlContextOutboundPathProcessor:: |
protected | property | ||
PurlContextOutboundPathProcessor:: |
protected | property | ||
PurlContextOutboundPathProcessor:: |
public | function | ||
PurlContextOutboundPathProcessor:: |
public | function | ||
PurlContextOutboundPathProcessor:: |
public static | function | Returns an array of event names this subscriber wants to listen to. | |
PurlContextOutboundPathProcessor:: |
public | function | ||
PurlContextOutboundPathProcessor:: |
public | function |
Processes the outbound path. Overrides OutboundPathProcessorInterface:: |
|
PurlContextOutboundPathProcessor:: |
public | function |