You are here

public function SimpleSitemapSyncExtend::extendPull in CMS Content Sync 2.0.x

Same name and namespace in other branches
  1. 8 modules/cms_content_sync_simple_sitemap/src/EventSubscriber/SimpleSitemapSyncExtend.php \Drupal\cms_content_sync_simple_sitemap\EventSubscriber\SimpleSitemapSyncExtend::extendPull()
  2. 2.1.x modules/cms_content_sync_simple_sitemap/src/EventSubscriber/SimpleSitemapSyncExtend.php \Drupal\cms_content_sync_simple_sitemap\EventSubscriber\SimpleSitemapSyncExtend::extendPull()

@internal param $entity @internal param $intent

Parameters

\Drupal\cms_content_sync\Event\BeforeEntityPull $event:

Throws

\Drupal\Component\Plugin\Exception\PluginNotFoundException

File

modules/cms_content_sync_simple_sitemap/src/EventSubscriber/SimpleSitemapSyncExtend.php, line 166

Class

SimpleSitemapSyncExtend
Event subscriptions for events dispatched by Content Sync.

Namespace

Drupal\cms_content_sync_simple_sitemap\EventSubscriber

Code

public function extendPull(BeforeEntityPull $event) {
  $intent = $event->intent;
  $entity = $intent
    ->getEntity();
  if (!$this
    ->sitemapSupportsEntityType($entity
    ->getEntityTypeId(), $entity
    ->bundle())) {
    return;
  }
  $values = $intent
    ->getProperty(self::PROPERTY_NAME);
  if (empty($values)) {
    return;
  }

  /**
   * @var \Drupal\simple_sitemap\Simplesitemap $generator
   */
  $generator = \Drupal::service('simple_sitemap.generator');
  $generator
    ->setEntityInstanceSettings($entity
    ->getEntityTypeId(), $entity
    ->id(), $values);
}