commit f655c0f13c9a66103303b2993c66454621e5388a Author: Andy Postnikov Date: Thu Sep 20 10:52:59 2012 +0700 Ranamed form controller diff --git a/core/modules/contact/contact.module b/core/modules/contact/contact.module index c998a14..c8b1bd2 100644 --- a/core/modules/contact/contact.module +++ b/core/modules/contact/contact.module @@ -205,7 +205,7 @@ function contact_entity_info() { 'entity class' => 'Drupal\contact\Category', 'controller class' => 'Drupal\config\ConfigStorageController', 'form controller class' => array( - 'default' => 'Drupal\contact\ContactFormController', + 'default' => 'Drupal\contact\CategoryFormController', ), 'config prefix' => 'contact.category', 'entity keys' => array( diff --git a/core/modules/contact/lib/Drupal/contact/ContactFormController.php b/core/modules/contact/lib/Drupal/contact/CategoryFormController.php similarity index 97% rename from core/modules/contact/lib/Drupal/contact/ContactFormController.php rename to core/modules/contact/lib/Drupal/contact/CategoryFormController.php index 1d588d7..170b5a0 100644 --- a/core/modules/contact/lib/Drupal/contact/ContactFormController.php +++ b/core/modules/contact/lib/Drupal/contact/CategoryFormController.php @@ -2,7 +2,7 @@ /** * @file - * Definition of Drupal\contact\ContactFormController. + * Definition of Drupal\contact\CategoryFormController. */ namespace Drupal\contact; @@ -13,7 +13,7 @@ use Drupal\Core\Entity\EntityFormController; /** * Base form controller for category edit forms. */ -class ContactFormController extends EntityFormController { +class CategoryFormController extends EntityFormController { /** * Overrides Drupal\Core\Entity\EntityFormController::form(). @@ -101,6 +101,19 @@ class ContactFormController extends EntityFormController { return NULL; } + return parent::submit($form, $form_state); + } + + /** + * Overrides Drupal\Core\Entity\EntityFormController::save(). + */ + public function save(array $form, array &$form_state) { + $category = $this->getEntity($form_state); + $category->save(); + + drupal_set_message(t('Category %label has been saved.', array('%label' => $category->label()))); + watchdog('contact', 'Category %label has been saved.', array('%label' => $category->label()), WATCHDOG_NOTICE, l(t('Edit'), 'admin/structure/contact/manage/' . $category->id())); + // Update the default category. $contact_config = config('contact.settings'); if ($form_state['values']['selected']) { @@ -118,19 +131,6 @@ class ContactFormController extends EntityFormController { // Remove the 'selected' value, which is not part of the Category. unset($form_state['values']['selected']); - return parent::submit($form, $form_state); - } - - /** - * Overrides Drupal\Core\Entity\EntityFormController::save(). - */ - public function save(array $form, array &$form_state) { - $category = $this->getEntity($form_state); - $category->save(); - - drupal_set_message(t('Category %label has been saved.', array('%label' => $category->label()))); - watchdog('contact', 'Category %label has been saved.', array('%label' => $category->label()), WATCHDOG_NOTICE, l(t('Edit'), 'admin/structure/contact/manage/' . $category->id())); - $form_state['redirect'] = 'admin/structure/contact'; } }