function ResolverRelationshipConfigure::submitForm

Same name in other branches
  1. 4.0.x src/Form/ResolverRelationshipConfigure.php \Drupal\ctools\Form\ResolverRelationshipConfigure::submitForm()

Overrides FormInterface::submitForm

File

src/Form/ResolverRelationshipConfigure.php, line 136

Class

ResolverRelationshipConfigure
Configure Relationships Resolver form.

Namespace

Drupal\ctools\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
    $cached_values = $this->tempstore
        ->get($this->tempstore_id)
        ->get($this->machine_name);
    $contexts = $this->getContexts($cached_values);
    $context = [
        'context' => $form_state->getValue('context'),
        'label' => $form_state->getValue('label'),
        'machine_name' => $form_state->getValue('machine_name'),
        'description' => $form_state->getValue('description'),
    ];
    if ($form_state->hasValue('id')) {
        $contexts[$form_state->getValue('id')] = $context;
    }
    else {
        $contexts[] = $context;
    }
    $cached_values = $this->setContexts($cached_values, $contexts);
    $this->tempstore
        ->get($this->tempstore_id)
        ->set($this->machine_name, $cached_values);
    [
        $route_name,
        $route_parameters,
    ] = $this->getParentRouteInfo($cached_values);
    $form_state->setRedirect($route_name, $route_parameters);
}