You are here

public function StaticGeneratorForm::exportPath in Tome 8

Exports a path using Tome.

Parameters

string $path: The path to export.

string $base_url: The base URL.

array $context: The batch context.

File

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

Class

StaticGeneratorForm
Contains a form for initializing a static build.

Namespace

Drupal\tome_static\Form

Code

public function exportPath($path, $base_url, array &$context) {
  $original_params = TomeStaticHelper::setBaseUrl($this
    ->getRequest(), $base_url);
  $this->requestPreparer
    ->prepareForRequest();
  try {
    $invoke_paths = $this->static
      ->requestPath($path);
  } catch (\Exception $e) {
    $context['results']['errors'][] = $this
      ->formatPathException($path, $e);
    $invoke_paths = [];
  }
  TomeStaticHelper::restoreBaseUrl($this
    ->getRequest(), $original_params);
  $context['results']['invoke_paths'] = isset($context['results']['invoke_paths']) ? $context['results']['invoke_paths'] : [];
  $context['results']['invoke_paths'] = array_merge($context['results']['invoke_paths'], $invoke_paths);
}