Commit d8968afa authored by Dave Reid's avatar Dave Reid Committed by Dave Reid
Browse files

Issue #2850367 by Dave Reid: Fixed xmlsitemap_get_changefreq() should return...

Issue #2850367 by Dave Reid: Fixed xmlsitemap_get_changefreq() should return untranslated values by default.
parent f1790fd8
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -66,7 +66,7 @@ class XmlSitemapUnitTest extends XmlSitemapTestBase {

    foreach ($values as $i => $value) {
      $actual = xmlsitemap_get_changefreq($value);
      $this->assertEquals($expected[$i], $actual);
      $this->assertSame($expected[$i], $actual);
    }
  }

+2 −2
Original line number Diff line number Diff line
@@ -1040,11 +1040,11 @@ function xmlsitemap_entity_bundle_delete($entity_type_id, $bundle) {
 * @param int $interval
 *   An interval value in seconds.
 *
 * @return string
 * @return string|\Drupal\Core\StringTranslation\TranslatableMarkup
 *   A string representing the update frequency according to the sitemaps.org
 *   protocol.
 */
function xmlsitemap_get_changefreq($interval, bool $translated = TRUE) {
function xmlsitemap_get_changefreq($interval, bool $translated = FALSE) {
  if ($interval <= 0 || !is_numeric($interval)) {
    return FALSE;
  }
+1 −1
Original line number Diff line number Diff line
@@ -91,7 +91,7 @@ class XmlSitemapCustomListController extends ControllerBase {
      $row = [];
      $row['loc'] = Link::fromTextAndUrl($link->loc, Url::fromUri('internal:' . $link->loc));
      $row['priority'] = number_format($link->priority, 1);
      $row['changefreq'] = $link->changefreq ? Unicode::ucfirst(xmlsitemap_get_changefreq($link->changefreq)) : $this->t('None');
      $row['changefreq'] = $link->changefreq ? Unicode::ucfirst(xmlsitemap_get_changefreq($link->changefreq, TRUE)) : $this->t('None');
      if (isset($header['language'])) {
        $row['language'] = $language->getName();
      }