/** * {@inheritdoc} */ public function submitForm(array &$form, FormStateInterface $form_state) { $this->page->removeVariant($this->displayVariant->id()); $this->page->save(); drupal_set_message($this->t('The display variant %name has been removed.', ['%name' => $this->displayVariant->label()])); $form_state->setRedirectUrl($this->getCancelUrl()); }
/** * {@inheritdoc} */ public function submitForm(array &$form, FormStateInterface $form_state) { // Allow the display variant to submit the form. $display_variant_values = (new FormState())->setValues($form_state->getValue('display_variant')); $this->displayVariant->submitConfigurationForm($form, $display_variant_values); // Update the original form values. $form_state->setValue('display_variant', $display_variant_values->getValues()); }
/** * {@inheritdoc} */ public function submitForm(array &$form, array &$form_state) { $this->displayVariant->removeBlock($this->block->getConfiguration()['uuid']); $this->page->save(); drupal_set_message($this->t('The block %name has been removed.', array('%name' => $this->block->getConfiguration()['label']))); if ($this->getRequest()->isXmlHttpRequest()) { $response = new AjaxResponse(); $response->addCommand(new CloseDialogCommand()); $response->addCommand(new LayoutBlockDelete($this->block)); $form_state['response'] = $response; return $response; } $form_state['redirect_route'] = $this->getCancelRoute(); }
/** * {@inheritdoc} */ public function submitForm(array &$form, array &$form_state) { $settings = array('values' => &$form_state['values']['settings'], 'errors' => $form_state['errors']); // Call the plugin submit handler. $this->block->submitConfigurationForm($form, $settings); if (!empty($form_state['values']['context_assignments'])) { $this->submitContextAssignment($this->block, $form_state['values']['context_assignments']); } $this->displayVariant->updateBlock($this->block->getConfiguration()['uuid'], array('region' => $this->layoutRegion->id())); $this->page->save(); if ($this->getRequest()->isXmlHttpRequest()) { $response = new AjaxResponse(); $response->addCommand(new CloseDialogCommand()); $response->addCommand(new LayoutBlockReload($this->block)); $form_state['response'] = $response; return $response; } return new Url('page_manager.display_variant_edit', array('page' => $this->page->id(), 'display_variant_id' => $this->displayVariant->id())); }
/** * Set Panels storage information on the variant, if it's a Panels variant. * * @param \Drupal\Core\Display\VariantInterface $variant_plugin */ protected function setPanelsStorage(VariantInterface $variant_plugin) { if ($variant_plugin instanceof PanelsDisplayVariant) { $variant_plugin->setStorage('page_manager', $this->entity->id()); } }