You are here

public function XmlSitemapGenerator::batchVariableSet in XML sitemap 8

Same name and namespace in other branches
  1. 2.x src/XmlSitemapGenerator.php \Drupal\xmlsitemap\XmlSitemapGenerator::batchVariableSet()

Set variables during the batch process.

Parameters

array $variables: Variables to be set.

Overrides XmlSitemapGeneratorInterface::batchVariableSet

File

src/XmlSitemapGenerator.php, line 594

Class

XmlSitemapGenerator
XmlSitemap generator service class.

Namespace

Drupal\xmlsitemap

Code

public function batchVariableSet(array $variables) {
  $state_variables = xmlsitemap_state_variables();
  foreach ($variables as $variable => $value) {
    if (isset($state_variables[$variable])) {
      $this->state
        ->set($variable, $value);
    }
    else {
      $this->config
        ->set($variable, $value);
      $this->config
        ->save();
    }
  }
}