UrlGeneratorPluginBase.php in Simple XML sitemap 8.2
File
src/Plugin/simple_sitemap/UrlGeneratorPluginBase.php
View source
<?php
namespace Drupal\simple_sitemap\Plugin\simple_sitemap;
use Drupal\Component\Plugin\ConfigurablePluginInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
abstract class UrlGeneratorPluginBase extends SimplesitemapPluginBase implements ConfigurablePluginInterface {
public $settings = [];
public $enabled = TRUE;
public $weight = 0;
public $provider;
public function __construct(array $configuration, $plugin_id, $plugin_definition) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
}
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition);
}
public function calculateDependencies() {
return [
'module' => 'simple_sitemap',
];
}
public function getConfiguration() {
return [
'id' => $this
->getPluginId(),
'provider' => $this->pluginDefinition['provider'],
'status' => $this->enabled,
'weight' => $this->weight,
'settings' => $this->settings,
];
}
public function setConfiguration(array $configuration) {
if (isset($configuration['enabled'])) {
$this->enabled = (bool) $configuration['enabled'];
}
if (isset($configuration['weight'])) {
$this->weight = (int) $configuration['weight'];
}
if (isset($configuration['settings'])) {
$this->settings = (array) $configuration['settings'];
}
return $this;
}
public function defaultConfiguration() {
return [
'enabled' => $this->pluginDefinition['enabled'],
'weight' => isset($this->pluginDefinition['weight']) ? $this->pluginDefinition['weight'] : 0,
'settings' => isset($this->pluginDefinition['settings']) ? $this->pluginDefinition['settings'] : [],
];
}
}