class ReplicatePathFieldSubscriber in Replicate 8
Class ReplicatePathFieldSubscriber.
@package Drupal\replicate\EventSubscriber
Hierarchy
- class \Drupal\replicate\EventSubscriber\ReplicatePathFieldSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
Expanded class hierarchy of ReplicatePathFieldSubscriber
1 string reference to 'ReplicatePathFieldSubscriber'
1 service uses ReplicatePathFieldSubscriber
File
- src/
EventSubscriber/ ReplicatePathFieldSubscriber.php, line 14
Namespace
Drupal\replicate\EventSubscriberView source
class ReplicatePathFieldSubscriber implements EventSubscriberInterface {
/**
* Cleans a path on an entity being replicated.
*
* @param ReplicateEntityFieldEvent $event
* The event we're working on.
*/
public function onPathClone(ReplicateEntityFieldEvent $event) {
$field_item_list = $event
->getFieldItemList();
foreach ($field_item_list as $field_item) {
$field_item->alias = NULL;
$field_item->pid = NULL;
}
}
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents() {
$events[ReplicatorEvents::replicateEntityField('path')][] = 'onPathClone';
return $events;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ReplicatePathFieldSubscriber:: |
public static | function | Returns an array of event names this subscriber wants to listen to. | |
ReplicatePathFieldSubscriber:: |
public | function | Cleans a path on an entity being replicated. |