You are here

public static function XmlSitemapWriter::toString in XML sitemap 2.x

Same name and namespace in other branches
  1. 8 src/XmlSitemapWriter.php \Drupal\xmlsitemap\XmlSitemapWriter::toString()

Convert translatable strings and URLs to strings.

Parameters

mixed $value: The value to turn into a string.

Return value

string The string value.

2 calls to XmlSitemapWriter::toString()
XmlSitemapWriter::formatXmlElements in src/XmlSitemapWriter.php
Copy of Drupal 7's format_xml_elements() function.
XmlSitemapWriter::writeElement in src/XmlSitemapWriter.php
Writes full element tag including support for nested elements.

File

src/XmlSitemapWriter.php, line 322

Class

XmlSitemapWriter
Extended class for writing XML sitemap files.

Namespace

Drupal\xmlsitemap

Code

public static function toString($value) {
  if (is_object($value)) {
    if ($value instanceof Url) {
      return $value
        ->toString();
    }
  }
  return (string) $value;
}