diff --git a/core/modules/config/tests/config_test/config_test.module b/core/modules/config/tests/config_test/config_test.module index e77b999..696ad7d 100644 --- a/core/modules/config/tests/config_test/config_test.module +++ b/core/modules/config/tests/config_test/config_test.module @@ -121,7 +121,7 @@ function config_test_menu() { ); $items['admin/structure/config_test/manage/%config_test'] = array( 'title' => 'Edit test configuration', - 'page callback' => 'config_test_edit', + 'page callback' => 'entity_get_form', 'page arguments' => array(4), 'access callback' => TRUE, ); @@ -167,14 +167,6 @@ function config_test_add() { } /** - * Menu callback: displays the 'Edit existing config_test form. - */ -function config_test_edit($entity) { - drupal_set_title(t('config_test @id', array('@id' => $entity->label)), PASS_THROUGH); - return entity_get_form($entity); -} - -/** * Form constructor to delete a ConfigTest object. * * @param Drupal\config_test\ConfigTest $config_test diff --git a/core/modules/config/tests/config_test/lib/Drupal/config_test/ConfigTestFormController.php b/core/modules/config/tests/config_test/lib/Drupal/config_test/ConfigTestFormController.php index a7e5830..4e97032 100644 --- a/core/modules/config/tests/config_test/lib/Drupal/config_test/ConfigTestFormController.php +++ b/core/modules/config/tests/config_test/lib/Drupal/config_test/ConfigTestFormController.php @@ -6,7 +6,7 @@ namespace Drupal\config_test; -use Drupal\Core\Entity\EntityInterace; +use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityFormControllerNG; /** @@ -73,11 +73,14 @@ public function submit(array $form, array &$form_state) { */ public function save(array $form, array &$form_state) { $entity = $this->getEntity($form_state); - $is_new = $entity->isNew(); - $entity->save(); + $status = $entity->save(); - $message = $is_new ? t('config_test @label has been created.', array('@label' => $entity->label())) : t('config_test @label has been updated.', array('@label' => $entity->label())); - drupal_set_message($message); + if ($status == SAVED_UPDATED) { + drupal_set_message(t('%label configuration has been updated.', array('%label' => $entity->label()))); + } + else { + drupal_set_message(t('%label configuration has been created.', array('%label' => $entity->label()))); + } if ($entity->id()) { $form_state['redirect'] = 'admin/structure/config_test/manage'; @@ -98,7 +101,5 @@ public function delete(array $form, array &$form_state) { drupal_set_message(t('config_test @label has been deleted.', array('@label' => $entity->label()))); $form_state['redirect'] = 'admin/structure/config_test/manage'; } -}; - -?> +}