You are here

public function XmlSitemapGenerator::batchVariableSet in XML sitemap 2.x

Same name and namespace in other branches
  1. 8 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();
    }
  }
}