Commit b38a60d1 authored by gbyte.co's avatar gbyte.co

Clean up some

parent 1c2cdead
...@@ -13,7 +13,8 @@ CONTENTS OF THIS FILE ...@@ -13,7 +13,8 @@ CONTENTS OF THIS FILE
INTRODUCTION INTRODUCTION
------------ ------------
Author and maintainer: Pawel Ginalski (gbyte.co) https://www.drupal.org/u/gbyte.co Author and maintainer: Pawel Ginalski (gbyte.co)
https://www.drupal.org/u/gbyte.co
The module generates a multilingual XML sitemap which adheres to Google's new The module generates a multilingual XML sitemap which adheres to Google's new
hreflang standard. Out of the box the sitemap is able to index most of Drupal's hreflang standard. Out of the box the sitemap is able to index most of Drupal's
......
...@@ -51,7 +51,7 @@ function hook_simple_sitemap_arbitrary_links_alter(&$arbitrary_links) { ...@@ -51,7 +51,7 @@ function hook_simple_sitemap_arbitrary_links_alter(&$arbitrary_links) {
'lastmod' => '2012-10-12T17:40:30+02:00', 'lastmod' => '2012-10-12T17:40:30+02:00',
'changefreq' => 'weekly', 'changefreq' => 'weekly',
'images' => [ 'images' => [
['path' =>'http://path-to-image.png'] ['path' => 'http://path-to-image.png']
] ]
]; ];
} }
......
...@@ -24,12 +24,12 @@ class UrlGenerator extends Plugin { ...@@ -24,12 +24,12 @@ class UrlGenerator extends Plugin {
public $id; public $id;
/** /**
* @var integer * @var int
*/ */
public $weight; public $weight;
/** /**
* @var boolean * @var bool
*/ */
public $instantiateForEachDataSet; public $instantiateForEachDataSet;
} }
...@@ -6,7 +6,6 @@ use Drupal\Core\Entity\ContentEntityTypeInterface; ...@@ -6,7 +6,6 @@ use Drupal\Core\Entity\ContentEntityTypeInterface;
use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Database\Connection; use Drupal\Core\Database\Connection;
use Drupal\Core\Entity\Entity;
use Drupal\Core\Url; use Drupal\Core\Url;
/** /**
......
...@@ -13,7 +13,7 @@ class SimplesitemapCustomLinksForm extends SimplesitemapFormBase { ...@@ -13,7 +13,7 @@ class SimplesitemapCustomLinksForm extends SimplesitemapFormBase {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getFormID() { public function getFormId() {
return 'simple_sitemap_custom_links_form'; return 'simple_sitemap_custom_links_form';
} }
...@@ -33,7 +33,7 @@ class SimplesitemapCustomLinksForm extends SimplesitemapFormBase { ...@@ -33,7 +33,7 @@ class SimplesitemapCustomLinksForm extends SimplesitemapFormBase {
'#type' => 'textarea', '#type' => 'textarea',
'#title' => $this->t('Relative Drupal paths'), '#title' => $this->t('Relative Drupal paths'),
'#default_value' => $this->customLinksToString($this->generator->getCustomLinks(FALSE)), '#default_value' => $this->customLinksToString($this->generator->getCustomLinks(FALSE)),
'#description' => $this->t('Please specify drupal internal (relative) paths, one per line. Do not forget to prepend the paths with a \'/\'.<br/>Optionally link priority <em>(0.0 - 1.0)</em> can be added by appending it after a space.<br/> Optionally link change frequency <em>(always / hourly / daily / weekly / monthly / yearly / never)</em> can be added by appending it after a space.<br/><br/><strong>Examples:</strong><br/><em>/ 1.0 daily</em> -> home page with the highest priority and daily change frequency<br/><em>/contact</em> -> contact page with the default priority and no change frequency information'), '#description' => $this->t("Please specify drupal internal (relative) paths, one per line. Do not forget to prepend the paths with a '/'.<br/>Optionally link priority <em>(0.0 - 1.0)</em> can be added by appending it after a space.<br/> Optionally link change frequency <em>(always / hourly / daily / weekly / monthly / yearly / never)</em> can be added by appending it after a space.<br/><br/><strong>Examples:</strong><br/><em>/ 1.0 daily</em> -> home page with the highest priority and daily change frequency<br/><em>/contact</em> -> contact page with the default priority and no change frequency information"),
]; ];
$form['simple_sitemap_custom']['include_images'] = [ $form['simple_sitemap_custom']['include_images'] = [
...@@ -72,7 +72,7 @@ class SimplesitemapCustomLinksForm extends SimplesitemapFormBase { ...@@ -72,7 +72,7 @@ class SimplesitemapCustomLinksForm extends SimplesitemapFormBase {
// Making sure the paths start with a slash. // Making sure the paths start with a slash.
if ($link_config['path'][0] != '/') { if ($link_config['path'][0] != '/') {
$form_state->setErrorByName('', $this->t('<strong>Line @line</strong>: The path <em>@path</em> needs to start with a \'/\'.', $placeholders)); $form_state->setErrorByName('', $this->t("<strong>Line @line</strong>: The path <em>@path</em> needs to start with a '/'.", $placeholders));
} }
// Making sure the priority is formatted correctly. // Making sure the priority is formatted correctly.
......
...@@ -13,7 +13,7 @@ class SimplesitemapEntitiesForm extends SimplesitemapFormBase { ...@@ -13,7 +13,7 @@ class SimplesitemapEntitiesForm extends SimplesitemapFormBase {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getFormID() { public function getFormId() {
return 'simple_sitemap_entities_form'; return 'simple_sitemap_entities_form';
} }
...@@ -61,7 +61,7 @@ class SimplesitemapEntitiesForm extends SimplesitemapFormBase { ...@@ -61,7 +61,7 @@ class SimplesitemapEntitiesForm extends SimplesitemapFormBase {
if ($form['simple_sitemap_entities']['entities'][$entity_type_id][$entity_type_id . '_enabled']['#default_value']) { if ($form['simple_sitemap_entities']['entities'][$entity_type_id][$entity_type_id . '_enabled']['#default_value']) {
$form['simple_sitemap_entities']['entities'][$entity_type_id][$entity_type_id . '_enabled']['#suffix'] $form['simple_sitemap_entities']['entities'][$entity_type_id][$entity_type_id . '_enabled']['#suffix']
= '<div id="warning-' . $css_entity_type_id . '">' = '<div id="warning-' . $css_entity_type_id . '">'
. $this->t('<strong>Warning:</strong> This entity type\'s sitemap settings including per-entity overrides will be deleted after hitting <em>Save</em>.') . $this->t("<strong>Warning:</strong> This entity type's sitemap settings including per-entity overrides will be deleted after hitting <em>Save</em>.")
. '</div>'; . '</div>';
} }
......
...@@ -14,7 +14,7 @@ class SimplesitemapSettingsForm extends SimplesitemapFormBase { ...@@ -14,7 +14,7 @@ class SimplesitemapSettingsForm extends SimplesitemapFormBase {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getFormID() { public function getFormId() {
return 'simple_sitemap_settings_form'; return 'simple_sitemap_settings_form';
} }
......
...@@ -436,8 +436,8 @@ abstract class UrlGeneratorBase extends SimplesitemapPluginBase implements UrlGe ...@@ -436,8 +436,8 @@ abstract class UrlGeneratorBase extends SimplesitemapPluginBase implements UrlGe
*/ */
protected function getImages($entity_type_name, $entity_id) { protected function getImages($entity_type_name, $entity_id) {
$images = []; $images = [];
foreach ($this->entityHelper->getEntityImageUrls($entity_type_name, $entity_id) as $Url) { foreach ($this->entityHelper->getEntityImageUrls($entity_type_name, $entity_id) as $url) {
$images[]['path'] = $this->replaceBaseUrlWithCustom($Url); $images[]['path'] = $this->replaceBaseUrlWithCustom($url);
} }
return $images; return $images;
} }
......
...@@ -191,7 +191,7 @@ class SimplesitemapTest extends SimplesitemapTestBase { ...@@ -191,7 +191,7 @@ class SimplesitemapTest extends SimplesitemapTestBase {
* @todo On second generation too many links in XML output here? * @todo On second generation too many links in XML output here?
*/ */
public function testRemoveDuplicatesSetting() { public function testRemoveDuplicatesSetting() {
$this->generator->setBundleSettings('node', 'page', ['index' => true]) $this->generator->setBundleSettings('node', 'page', ['index' => TRUE])
->addCustomLink('/node/1') ->addCustomLink('/node/1')
->saveSetting('remove_duplicates', TRUE) ->saveSetting('remove_duplicates', TRUE)
->generateSitemap('nobatch'); ->generateSitemap('nobatch');
...@@ -233,7 +233,7 @@ class SimplesitemapTest extends SimplesitemapTestBase { ...@@ -233,7 +233,7 @@ class SimplesitemapTest extends SimplesitemapTestBase {
public function testBatchProcessLimitSetting() { public function testBatchProcessLimitSetting() {
// Create some nodes. // Create some nodes.
for ($i = 3; $i <=50; $i++) { for ($i = 3; $i <= 50; $i++) {
$this->createNode(['title' => "Node{$i}", 'type' => 'page']); $this->createNode(['title' => "Node{$i}", 'type' => 'page']);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment