You are here

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'
replicate.services.yml in ./replicate.services.yml
replicate.services.yml
1 service uses ReplicatePathFieldSubscriber
replicate.event_subscriber.path_item in ./replicate.services.yml
\Drupal\replicate\EventSubscriber\ReplicatePathFieldSubscriber

File

src/EventSubscriber/ReplicatePathFieldSubscriber.php, line 14

Namespace

Drupal\replicate\EventSubscriber
View 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

Namesort descending Modifiers Type Description Overrides
ReplicatePathFieldSubscriber::getSubscribedEvents public static function Returns an array of event names this subscriber wants to listen to.
ReplicatePathFieldSubscriber::onPathClone public function Cleans a path on an entity being replicated.