You are here

function xmlsitemap_var in XML sitemap 2.x

Same name and namespace in other branches
  1. 8 xmlsitemap.module \xmlsitemap_var()
  2. 6.2 xmlsitemap.module \xmlsitemap_var()
  3. 7.2 xmlsitemap.module \xmlsitemap_var()

Internal implementation of variable_get().

5 calls to xmlsitemap_var()
XmlSitemapSettingsForm::buildForm in src/Form/XmlSitemapSettingsForm.php
Form constructor.
XmlSitemapTestBase::assertFlag in tests/src/Functional/XmlSitemapTestBase.php
Assert Flag.
XmlSitemapUnitTest::testAssertFlag in tests/src/Functional/XmlSitemapUnitTest.php
Tests for xmlsitemap flags.
XmlSitemapWriter::endDocument in src/XmlSitemapWriter.php
Ends an XML document.
xmlsitemap_get_chunk_size in ./xmlsitemap.module
Get the sitemap chunk size.

File

./xmlsitemap.module, line 272
xmlsitemap XML sitemap

Code

function xmlsitemap_var($name, $default = NULL) {
  $defaults =& drupal_static(__FUNCTION__);
  if (!isset($defaults)) {
    $defaults = xmlsitemap_config_variables();
    $defaults += xmlsitemap_state_variables();
  }

  // @todo Remove when stable.
  if (!isset($defaults[$name])) {
    trigger_error("Default variable for {$name} not found.");
  }
  if (\Drupal::state()
    ->get($name, NULL) === NULL) {
    return \Drupal::config('xmlsitemap.settings')
      ->get($name);
  }
  return \Drupal::state()
    ->get($name);
}