function ManageContext::submitForm

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

Overrides FormInterface::submitForm

File

src/Form/ManageContext.php, line 164

Class

ManageContext
Manage Context Form.

Namespace

Drupal\ctools\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
    if ($form_state->getTriggeringElement()['#name'] == 'add') {
        $cached_values = $form_state->getTemporaryValue('wizard');
        [
            ,
            $route_parameters,
        ] = $this->getContextOperationsRouteInfo($cached_values, $this->machine_name, $form_state->getValue('context'));
        $form_state->setRedirect($this->getContextAddRoute($cached_values), $route_parameters);
    }
    if ($form_state->getTriggeringElement()['#name'] == 'add_relationship') {
        $cached_values = $form_state->getTemporaryValue('wizard');
        [
            ,
            $route_parameters,
        ] = $this->getRelationshipOperationsRouteInfo($cached_values, $this->machine_name, $form_state->getValue('relationships'));
        $form_state->setRedirect($this->getRelationshipAddRoute($cached_values), $route_parameters);
    }
}