/** * {@inheritdoc} */ public function submitForm(array &$form, FormStateInterface $form_state) { parent::submitForm($form, $form_state); $configuration = $this->condition->getConfiguration(); // If this selection condition is new, add it to the page. if (!isset($configuration['uuid'])) { $this->pageVariant->addSelectionCondition($configuration); } // Save the page entity. $this->pageVariant->save(); $form_state->setRedirectUrl($this->pageVariant->toUrl('edit-form')); }
/** * {@inheritdoc} */ public function submitForm(array &$form, FormStateInterface $form_state) { $selection = $form_state->getValue('selection'); $entity_type = $form_state->getValue('entity_type'); $entity = $this->getEntityFromSelection($entity_type, $selection); $this->staticContext = ['label' => $form_state->getValue('label'), 'type' => 'entity:' . $entity_type, 'value' => $entity->uuid()]; $this->pageVariant->setStaticContext($form_state->getValue('machine_name'), $this->staticContext); $this->pageVariant->save(); // Set the submission message. drupal_set_message($this->submitMessageText()); $form_state->setRedirectUrl($this->pageVariant->toUrl('edit-form')); }
/** * {@inheritdoc} */ public function submitForm(array &$form, FormStateInterface $form_state) { $settings = (new FormState())->setValues($form_state->getValue('settings')); // Call the plugin submit handler. $this->block->submitConfigurationForm($form, $settings); // Update the original form values. $form_state->setValue('settings', $settings->getValues()); if ($this->block instanceof ContextAwarePluginInterface) { $this->block->setContextMapping($form_state->getValue('context_mapping', [])); } $this->getVariantPlugin()->updateBlock($this->block->getConfiguration()['uuid'], ['region' => $form_state->getValue('region')]); $this->pageVariant->save(); $form_state->setRedirectUrl($this->pageVariant->toUrl('edit-form')); }
/** * {@inheritdoc} */ public function getCancelUrl() { return $this->pageVariant->toUrl('edit-form'); }