diff --git a/core/modules/system/tests/modules/entity_test/entity_test.module b/core/modules/system/tests/modules/entity_test/entity_test.module index a46a1e7..23cec8f 100644 --- a/core/modules/system/tests/modules/entity_test/entity_test.module +++ b/core/modules/system/tests/modules/entity_test/entity_test.module @@ -272,43 +272,6 @@ function entity_test_form_node_form_alter(&$form, &$form_state, $form_id) { } /** - * Menu callback: displays the 'Add new entity_test' form. - * - * @param string $entity_type - * Name of the entity type for which a create form should be displayed. - * - * @return array - * The processed form for a new entity_test. - * - * @see entity_test_menu() - * - * @deprecated \Drupal\entity_test\Controller\EntityTestController::testAdd() - */ -function entity_test_add($entity_type) { - drupal_set_title(t('Create an @type', array('@type' => $entity_type))); - $entity = entity_create($entity_type); - return \Drupal::service('entity.form_builder')->getForm($entity); -} - -/** - * Menu callback: displays the 'Edit existing entity_test' form. - * - * @param \Drupal\Core\Entity\EntityInterface $entity - * The entity to be edited. - * - * @return array - * The processed form for the edited entity. - * - * @see entity_test_menu() - * - * @deprecated \Drupal\entity_test\Controller\EntityTestController::testEdit() - */ -function entity_test_edit(EntityInterface $entity) { - drupal_set_title($entity->label(), PASS_THROUGH); - return \Drupal::service('entity.form_builder')->getForm($entity); -} - -/** * Loads a test entity. * * @param int $id diff --git a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Controller/EntityTestController.php b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Controller/EntityTestController.php index a6a42ee..45d1f82 100644 --- a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Controller/EntityTestController.php +++ b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Controller/EntityTestController.php @@ -7,27 +7,48 @@ namespace Drupal\entity_test\Controller; -use Drupal\Core\Entity\EntityInterface; +use Drupal\Core\Controller\ControllerBase; use Symfony\Component\HttpFoundation\Request; /** * Controller routines for entity_test routes. */ -class EntityTestController { +class EntityTestController extends ControllerBase { /** - * @todo Remove entity_test_add() + * Displays the 'Add new entity_test' form. + * + * @param string $entity_type + * Name of the entity type for which a create form should be displayed. + * + * @return array + * The processed form for a new entity_test. + * + * @see entity_test_menu() */ public function testAdd($entity_type) { - return entity_test_add($entity_type); + $entity = entity_create($entity_type, array()); + $form = $this->entityFormBuilder()->getForm($entity); + $form['#title'] = $this->t('Create an @type', array('@type' => $entity_type)); + return $form; } /** - * @todo Remove entity_test_edit() + * Displays the 'Edit existing entity_test' form. + * + * @param \Symfony\Component\HttpFoundation\Request $request + * The request object to get entity type from. + * + * @return array + * The processed form for the edited entity. + * + * @see entity_test_menu() */ public function testEdit(Request $request) { $entity = $request->attributes->get($request->attributes->get('_entity_type')); - return entity_test_edit($entity); + $form = $this->entityFormBuilder()->getForm($entity); + $form['#title'] = $entity->label(); + return $form; } /**