...
 
Commits (3)
......@@ -103,42 +103,42 @@ function simple_sitemap_entity_form_submit($form, FormStateInterface &$form_stat
/** @var \Drupal\simple_sitemap\Simplesitemap $generator */
$generator = \Drupal::service('simple_sitemap.generator');
// Only save other values if indexing is enabled.
if ($settings['index'] = (bool) $values['simple_sitemap_index_content']) {
$settings['priority'] = $values['simple_sitemap_priority'];
$settings['changefreq'] = $values['simple_sitemap_changefreq'];
$settings['include_images'] = (bool) $values['simple_sitemap_include_images'];
}
// Deleting bundle settings for old bundle.
// See SimplesitemapEntitiesForm::submitForm().
// 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'];
if ($old_variant !== $values['simple_sitemap_variant']) {
$generator->setVariants($old_variant)->removeBundleSettings($f->getEntityTypeId(), $f->getBundleName());
foreach ($generator->getSitemapManager()->getSitemapVariants(NULL, FALSE) as $variant => $definition) {
if (isset($values['index_' . $variant])) { // Variants may have changed since form load.
$settings = [
'index' => (bool) $values['index_' . $variant],
'priority' => $values['priority_' . $variant],
'changefreq' => $values['changefreq_' . $variant],
'include_images' => (bool) $values['include_images_' . $variant],
];
$generator->setVariants($variant);
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.
if ($values['simple_sitemap_regenerate_now']) {
$generator->rebuildQueue()->generateSitemap();
......
......@@ -91,6 +91,8 @@ class SimplesitemapController extends ControllerBase {
'[priority]' => $this->t('Priority'),
'[translation-set]' => $this->t('Translation set'),
'[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-tablesorter]' => base_path() . $module_path . '/xsl/jquery.tablesorter.min.js',
'[parser-date-iso8601]' => base_path() . $module_path . '/xsl/parser-date-iso8601.min.js',
......
This diff is collapsed.
......@@ -133,9 +133,9 @@
<xsl:if test="/sitemap:urlset/sitemap:url/xhtml:link">
<td>
<xsl:if test="xhtml:link">
<dl class="translation-set">
<ul class="translation-set">
<xsl:apply-templates select="xhtml:link"/>
</dl>
</ul>
</xsl:if>
</td>
</xsl:if>
......@@ -154,20 +154,17 @@
<!-- xhtml:link template -->
<xsl:template match="xhtml:link">
<xsl:variable name="url_language">
<xsl:value-of select="@hreflang"/>
</xsl:variable>
<xsl:variable name="url_location">
<xsl:value-of select="@href"/>
</xsl:variable>
<dt>
<xsl:value-of select="$url_language"/>
</dt>
<dd>
<li>
<span>
<xsl:value-of select="@hreflang"/>
</span>
<a href="{$url_location}">
<xsl:value-of select="$url_location"/>
</a>
</dd>
</li>
</xsl:template>
<!-- image:image template -->
......@@ -179,6 +176,20 @@
<a href="{$image_location}">
<xsl:value-of select="$image_location"/>
</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>
</xsl:template>
......
......@@ -64,29 +64,28 @@ table.sitemap thead tr .tablesorter-headerDesc .tablesorter-header-inner:after {
right: 0;
}
table.sitemap tbody tr dl.translation-set {
table.sitemap tbody tr ul {
list-style: none;
padding: 0;
margin: 0;
}
table.sitemap tbody tr dl.translation-set dt {
text-transform: uppercase;
float: left;
padding: 0;
margin: 0 5px 0 0;
table.sitemap tbody tr ul li:not(:first-of-type) {
margin-top: 5px;
}
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: ":";
}
table.sitemap tbody tr dl.translation-set dd {
padding: 0;
margin: 0;
table.sitemap tbody tr ul.translation-set li span {
text-transform: uppercase;
}
table.sitemap tbody tr ul.images {
list-style: none;
padding: 0;
margin: 0;
table.sitemap tbody tr ul.images li span {
font-style: italic;
}