class PathAutoAliasSubscriber in Multiversion 8
Creating a flag to skip generating new alias.
Hierarchy
- class \Drupal\multiversion\EventSubscriber\PathAutoAliasSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
Expanded class hierarchy of PathAutoAliasSubscriber
1 string reference to 'PathAutoAliasSubscriber'
1 service uses PathAutoAliasSubscriber
File
- src/
EventSubscriber/ PathAutoAliasSubscriber.php, line 14
Namespace
Drupal\multiversion\EventSubscriberView source
class PathAutoAliasSubscriber implements EventSubscriberInterface {
/**
* @var \Drupal\Core\State\StateInterface
*/
protected $state;
/**
* Class constructor.
*
* @param \Drupal\Core\State\StateInterface $state
*/
public function __construct(StateInterface $state) {
$this->state = $state;
}
/**
* Set flag for disabling alias generate.
*
* @param \Drupal\multiversion\Event\MultiversionManagerEvent $event
*/
public function onPreMigrate(MultiversionManagerEvent $event) {
$this->state
->set('skip_alias_save', TRUE);
}
/**
* Remove flag "skip_pathauto_generator".
*
* @param \Drupal\multiversion\Event\MultiversionManagerEvent $event
*/
public function onPostMigrate(MultiversionManagerEvent $event) {
$this->state
->delete('skip_alias_save');
}
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents() {
return [
MultiversionManagerEvents::PRE_MIGRATE => [
'onPreMigrate',
],
MultiversionManagerEvents::POST_MIGRATE => [
'onPostMigrate',
],
];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PathAutoAliasSubscriber:: |
protected | property | ||
PathAutoAliasSubscriber:: |
public static | function | Returns an array of event names this subscriber wants to listen to. | |
PathAutoAliasSubscriber:: |
public | function | Remove flag "skip_pathauto_generator". | |
PathAutoAliasSubscriber:: |
public | function | Set flag for disabling alias generate. | |
PathAutoAliasSubscriber:: |
public | function | Class constructor. |