/**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, array &$form_state)
 {
     $this->pageVariant->removeLayoutRegion($this->layoutRegion->id());
     $this->page->save();
     drupal_set_message($this->t('The layout region %name has been removed.', array('%name' => $this->layoutRegion->label())));
     if ($this->getRequest()->isXmlHttpRequest()) {
         $response = new AjaxResponse();
         $response->addCommand(new CloseDialogCommand());
         $response->addCommand(new LayoutReload($this->pageVariant));
         $form_state['response'] = $response;
         return $response;
     }
     $form_state['redirect_route'] = $this->getCancelRoute();
 }
示例#2
0
 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, array &$form_state)
 {
     // Allow the page variant to submit the form.
     $plugin_values = array('values' => &$form_state['values']['plugin']);
     $this->layoutRegion->submitConfigurationForm($form, $plugin_values);
     $this->pageVariant->updateLayoutRegion($this->layoutRegion->id(), array('label' => $this->layoutRegion->label(), 'parent' => $this->layoutRegion->getParentRegionId()));
     $this->page->save();
     if ($this->getRequest()->isXmlHttpRequest()) {
         $response = new AjaxResponse();
         $response->addCommand(new CloseDialogCommand());
         if ($this->getFormId() === 'layout_layout_region_add_form') {
             $response->addCommand(new LayoutReload($this->pageVariant));
         } else {
             $response->addCommand(new LayoutRegionReload($this->pageVariant, $this->layoutRegion));
         }
         $form_state['response'] = $response;
         return $response;
     }
     $form_state['redirect_route'] = new Url('page_manager.display_variant_edit', array('page' => $this->page->id(), 'display_variant_id' => $this->pageVariant->id()));
 }