You are here

protected function ContainerForm::submitConditionsForm in GoogleTagManager 8

Form submission handler for the insertion conditions.

Parameters

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

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

1 call to ContainerForm::submitConditionsForm()
ContainerForm::submitForm in src/Form/ContainerForm.php
This is the default entity object builder function. It is called before any other submit handler to build the new entity object to be used by the following submit handlers. At this point of the form workflow the entity is validated and the form state…

File

src/Form/ContainerForm.php, line 277

Class

ContainerForm
Defines the Google tag manager container settings form.

Namespace

Drupal\google_tag\Form

Code

protected function submitConditionsForm(array $form, FormStateInterface $form_state) {
  $condition_ids = $form_state
    ->getTemporaryValue('filtered_conditions');
  foreach ($condition_ids as $condition_id) {
    $values = $form_state
      ->getValue($condition_id);

    // Allow the condition to submit the form.
    $condition = $form_state
      ->get([
      'conditions',
      $condition_id,
    ]);
    $condition
      ->submitConfigurationForm($form[$condition_id], SubformState::createForSubform($form[$condition_id], $form, $form_state));
    $configuration = $condition
      ->getConfiguration();

    // Update the insertion conditions on the container.
    $this->entity
      ->setInsertionCondition($condition_id, $configuration);
  }
}