View source
<?php
namespace Drupal\simple_sitemap\Plugin\simple_sitemap\UrlGenerator;
use Drupal\simple_sitemap\EntityHelper;
use Drupal\simple_sitemap\Logger;
use Drupal\simple_sitemap\Simplesitemap;
use Drupal\simple_sitemap\SitemapGenerator;
use Drupal\Core\Language\LanguageManagerInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Extension\ModuleHandler;
use Symfony\Component\DependencyInjection\ContainerInterface;
class ArbitraryUrlGenerator extends UrlGeneratorBase {
protected $moduleHandler;
public function __construct(array $configuration, $plugin_id, $plugin_definition, Simplesitemap $generator, SitemapGenerator $sitemap_generator, LanguageManagerInterface $language_manager, EntityTypeManagerInterface $entity_type_manager, Logger $logger, EntityHelper $entityHelper, ModuleHandler $module_handler) {
parent::__construct($configuration, $plugin_id, $plugin_definition, $generator, $sitemap_generator, $language_manager, $entity_type_manager, $logger, $entityHelper);
$this->moduleHandler = $module_handler;
}
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition, $container
->get('simple_sitemap.generator'), $container
->get('simple_sitemap.sitemap_generator'), $container
->get('language_manager'), $container
->get('entity_type.manager'), $container
->get('simple_sitemap.logger'), $container
->get('simple_sitemap.entity_helper'), $container
->get('module_handler'));
}
public function getDataSets() {
$arbitrary_links = [];
$this->moduleHandler
->alter('simple_sitemap_arbitrary_links', $arbitrary_links);
return array_values($arbitrary_links);
}
protected function processDataSet($data_set) {
return $data_set;
}
}