UrlGeneratorBase.php in Simple XML sitemap 8.3
File
src/Plugin/simple_sitemap/UrlGenerator/UrlGeneratorBase.php
View source
<?php
namespace Drupal\simple_sitemap\Plugin\simple_sitemap\UrlGenerator;
use Drupal\simple_sitemap\Plugin\simple_sitemap\SimplesitemapPluginBase;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\simple_sitemap\Logger;
use Drupal\simple_sitemap\Simplesitemap;
abstract class UrlGeneratorBase extends SimplesitemapPluginBase implements UrlGeneratorInterface {
protected $generator;
protected $logger;
protected $settings;
protected $sitemapVariant;
public function __construct(array $configuration, $plugin_id, $plugin_definition, Simplesitemap $generator, Logger $logger) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->generator = $generator;
$this->logger = $logger;
}
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.logger'));
}
public function setSettings(array $settings) {
$this->settings = $settings;
return $this;
}
public function setSitemapVariant($sitemap_variant) {
$this->sitemapVariant = $sitemap_variant;
return $this;
}
protected function replaceBaseUrlWithCustom($url) {
return !empty($this->settings['base_url']) ? str_replace($GLOBALS['base_url'], $this->settings['base_url'], $url) : $url;
}
public abstract function getDataSets();
protected abstract function processDataSet($data_set);
public function generate($data_set) {
$path_data = $this
->processDataSet($data_set);
return FALSE !== $path_data ? [
$path_data,
] : [];
}
}
Classes
Name |
Description |
UrlGeneratorBase |
Class UrlGeneratorBase
@package Drupal\simple_sitemap\Plugin\simple_sitemap\UrlGenerator |