You are here

public function StaticGeneratorForm::batchInvokePaths in Tome 8

Exports all remaining paths at the end of a previous batch.

Parameters

string $base_url: The base URL.

array $context: The batch context.

File

modules/tome_static/src/Form/StaticGeneratorForm.php, line 171

Class

StaticGeneratorForm
Contains a form for initializing a static build.

Namespace

Drupal\tome_static\Form

Code

public function batchInvokePaths($base_url, array &$context) {
  if (!empty($context['results']['invoke_paths'])) {
    $context['results']['old_paths'] = isset($context['results']['old_paths']) ? $context['results']['old_paths'] : [];
    $context['results']['invoke_paths'] = array_diff($context['results']['invoke_paths'], $context['results']['old_paths']);
    $context['results']['old_paths'] = array_merge($context['results']['invoke_paths'], $context['results']['old_paths']);
    $invoke_paths = $this->static
      ->exportPaths($context['results']['invoke_paths']);
    if (!empty($invoke_paths)) {
      $this
        ->setBatch($invoke_paths, $base_url);
    }
  }
}