...
 
Commits (3)
...@@ -103,42 +103,42 @@ function simple_sitemap_entity_form_submit($form, FormStateInterface &$form_stat ...@@ -103,42 +103,42 @@ function simple_sitemap_entity_form_submit($form, FormStateInterface &$form_stat
/** @var \Drupal\simple_sitemap\Simplesitemap $generator */ /** @var \Drupal\simple_sitemap\Simplesitemap $generator */
$generator = \Drupal::service('simple_sitemap.generator'); $generator = \Drupal::service('simple_sitemap.generator');
// Only save other values if indexing is enabled. foreach ($generator->getSitemapManager()->getSitemapVariants(NULL, FALSE) as $variant => $definition) {
if ($settings['index'] = (bool) $values['simple_sitemap_index_content']) {
$settings['priority'] = $values['simple_sitemap_priority']; if (isset($values['index_' . $variant])) { // Variants may have changed since form load.
$settings['changefreq'] = $values['simple_sitemap_changefreq'];
$settings['include_images'] = (bool) $values['simple_sitemap_include_images']; $settings = [
} 'index' => (bool) $values['index_' . $variant],
'priority' => $values['priority_' . $variant],
// Deleting bundle settings for old bundle. 'changefreq' => $values['changefreq_' . $variant],
// See SimplesitemapEntitiesForm::submitForm(). 'include_images' => (bool) $values['include_images_' . $variant],
// todo: Not necessary once https://www.drupal.org/project/simple_sitemap/issues/3014649 is implemented. ];
if (isset($form['simple_sitemap']['simple_sitemap_variant']['#default_value'])) {
$old_variant = $form['simple_sitemap']['simple_sitemap_variant']['#default_value']; $generator->setVariants($variant);
if ($old_variant !== $values['simple_sitemap_variant']) {
$generator->setVariants($old_variant)->removeBundleSettings($f->getEntityTypeId(), $f->getBundleName()); switch ($f->getEntityCategory()) {
case 'bundle':
$generator->setBundleSettings($f->getEntityTypeId(),
!empty($f->getBundleName()) ? $f->getBundleName() : $f->getFormEntityId(),
$settings
);
if (empty($settings['index'])) {
$generator->removeEntityInstanceSettings($f->getEntityTypeId(), $f->getInstanceId());
}
break;
case 'instance':
$generator->setEntityInstanceSettings($f->getEntityTypeId(),
!empty($f->getInstanceId()) ? $f->getInstanceId() : $f->getFormEntityId(),
$settings
);
break;
}
} }
} }
switch ($f->getEntityCategory()) {
case 'bundle':
$generator->setVariants($values['simple_sitemap_variant'])
->setBundleSettings($f->getEntityTypeId(),
!empty($f->getBundleName()) ? $f->getBundleName() : $f->getFormEntityId(),
$settings
);
break;
case 'instance':
$generator->setVariants($values['simple_sitemap_variant'])
->setEntityInstanceSettings($f->getEntityTypeId(),
!empty($f->getInstanceId()) ? $f->getInstanceId() : $f->getFormEntityId(),
$settings
);
break;
}
// Regenerate sitemaps according to user setting. // Regenerate sitemaps according to user setting.
if ($values['simple_sitemap_regenerate_now']) { if ($values['simple_sitemap_regenerate_now']) {
$generator->rebuildQueue()->generateSitemap(); $generator->rebuildQueue()->generateSitemap();
......
...@@ -91,6 +91,8 @@ class SimplesitemapController extends ControllerBase { ...@@ -91,6 +91,8 @@ class SimplesitemapController extends ControllerBase {
'[priority]' => $this->t('Priority'), '[priority]' => $this->t('Priority'),
'[translation-set]' => $this->t('Translation set'), '[translation-set]' => $this->t('Translation set'),
'[images]' => $this->t('Images'), '[images]' => $this->t('Images'),
'[image-title]' => $this->t('Title'),
'[image-caption]' => $this->t('Caption'),
'[jquery]' => base_path() . 'core/assets/vendor/jquery/jquery.min.js', '[jquery]' => base_path() . 'core/assets/vendor/jquery/jquery.min.js',
'[jquery-tablesorter]' => base_path() . $module_path . '/xsl/jquery.tablesorter.min.js', '[jquery-tablesorter]' => base_path() . $module_path . '/xsl/jquery.tablesorter.min.js',
'[parser-date-iso8601]' => base_path() . $module_path . '/xsl/parser-date-iso8601.min.js', '[parser-date-iso8601]' => base_path() . $module_path . '/xsl/parser-date-iso8601.min.js',
......
This diff is collapsed.
...@@ -133,9 +133,9 @@ ...@@ -133,9 +133,9 @@
<xsl:if test="/sitemap:urlset/sitemap:url/xhtml:link"> <xsl:if test="/sitemap:urlset/sitemap:url/xhtml:link">
<td> <td>
<xsl:if test="xhtml:link"> <xsl:if test="xhtml:link">
<dl class="translation-set"> <ul class="translation-set">
<xsl:apply-templates select="xhtml:link"/> <xsl:apply-templates select="xhtml:link"/>
</dl> </ul>
</xsl:if> </xsl:if>
</td> </td>
</xsl:if> </xsl:if>
...@@ -154,20 +154,17 @@ ...@@ -154,20 +154,17 @@
<!-- xhtml:link template --> <!-- xhtml:link template -->
<xsl:template match="xhtml:link"> <xsl:template match="xhtml:link">
<xsl:variable name="url_language">
<xsl:value-of select="@hreflang"/>
</xsl:variable>
<xsl:variable name="url_location"> <xsl:variable name="url_location">
<xsl:value-of select="@href"/> <xsl:value-of select="@href"/>
</xsl:variable> </xsl:variable>
<dt> <li>
<xsl:value-of select="$url_language"/> <span>
</dt> <xsl:value-of select="@hreflang"/>
<dd> </span>
<a href="{$url_location}"> <a href="{$url_location}">
<xsl:value-of select="$url_location"/> <xsl:value-of select="$url_location"/>
</a> </a>
</dd> </li>
</xsl:template> </xsl:template>
<!-- image:image template --> <!-- image:image template -->
...@@ -179,6 +176,20 @@ ...@@ -179,6 +176,20 @@
<a href="{$image_location}"> <a href="{$image_location}">
<xsl:value-of select="$image_location"/> <xsl:value-of select="$image_location"/>
</a> </a>
<!-- Show this element only if image:caption element is present -->
<xsl:if test="image:caption">
<div>
<span>[image-caption]</span>
<xsl:value-of select="image:caption"/>
</div>
</xsl:if>
<!-- Show this element only if image:title element is present -->
<xsl:if test="image:title">
<div>
<span>[image-title]</span>
<xsl:value-of select="image:title"/>
</div>
</xsl:if>
</li> </li>
</xsl:template> </xsl:template>
......
...@@ -64,29 +64,28 @@ table.sitemap thead tr .tablesorter-headerDesc .tablesorter-header-inner:after { ...@@ -64,29 +64,28 @@ table.sitemap thead tr .tablesorter-headerDesc .tablesorter-header-inner:after {
right: 0; right: 0;
} }
table.sitemap tbody tr dl.translation-set { table.sitemap tbody tr ul {
list-style: none;
padding: 0; padding: 0;
margin: 0; margin: 0;
} }
table.sitemap tbody tr dl.translation-set dt { table.sitemap tbody tr ul li:not(:first-of-type) {
text-transform: uppercase; margin-top: 5px;
float: left;
padding: 0;
margin: 0 5px 0 0;
} }
table.sitemap tbody tr dl.translation-set dt:after { table.sitemap tbody tr ul li span {
margin-right: 5px;
}
table.sitemap tbody tr ul li span:after {
content: ":"; content: ":";
} }
table.sitemap tbody tr dl.translation-set dd { table.sitemap tbody tr ul.translation-set li span {
padding: 0; text-transform: uppercase;
margin: 0;
} }
table.sitemap tbody tr ul.images { table.sitemap tbody tr ul.images li span {
list-style: none; font-style: italic;
padding: 0;
margin: 0;
} }