You are here

public function StaticGeneratorForm::submitForm in Tome 8

Form submission handler.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Overrides FormInterface::submitForm

File

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

Class

StaticGeneratorForm
Contains a form for initializing a static build.

Namespace

Drupal\tome_static\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $this->state
    ->set(StaticGeneratorInterface::STATE_KEY_BUILDING, TRUE);
  $base_url = $form_state
    ->getValue('base_url');
  $this->state
    ->set(StaticGeneratorInterface::STATE_KEY_URL, $base_url);
  $this->static
    ->cleanupStaticDirectory();
  $this->static
    ->prepareStaticDirectory();
  $original_params = TomeStaticHelper::setBaseUrl($this
    ->getRequest(), $base_url);
  $paths = $this->static
    ->getPaths();
  TomeStaticHelper::restoreBaseUrl($this
    ->getRequest(), $original_params);
  $this
    ->setBatch($paths, $base_url);
}