X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=web%2Fmodules%2Fcontrib%2Fsimple_sitemap%2Fsrc%2FPlugin%2Fsimple_sitemap%2FUrlGeneratorPluginBase.php;fp=web%2Fmodules%2Fcontrib%2Fsimple_sitemap%2Fsrc%2FPlugin%2Fsimple_sitemap%2FUrlGeneratorPluginBase.php;h=e9bc7db3108561b959dfcd37da1b8f3263f172eb;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hp=0000000000000000000000000000000000000000;hpb=680c79a86e3ed402f263faeac92e89fb6d9edcc0;p=yaffs-website diff --git a/web/modules/contrib/simple_sitemap/src/Plugin/simple_sitemap/UrlGeneratorPluginBase.php b/web/modules/contrib/simple_sitemap/src/Plugin/simple_sitemap/UrlGeneratorPluginBase.php new file mode 100644 index 000000000..e9bc7db31 --- /dev/null +++ b/web/modules/contrib/simple_sitemap/src/Plugin/simple_sitemap/UrlGeneratorPluginBase.php @@ -0,0 +1,94 @@ + 'simple_sitemap']; + } + + /** + * {@inheritdoc} + */ + public function getConfiguration() { + return [ + 'id' => $this->getPluginId(), + 'provider' => $this->pluginDefinition['provider'], + 'status' => $this->enabled, + 'weight' => $this->weight, + 'settings' => $this->settings, + ]; + } + + /** + * {@inheritdoc} + */ + 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; + } + + /** + * {@inheritdoc} + */ + 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'] : [], + ]; + } +}