You are here

public function EntityTestController::testAdd in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/tests/modules/entity_test/src/Controller/EntityTestController.php \Drupal\entity_test\Controller\EntityTestController::testAdd()

Displays the 'Add new entity_test' form.

Parameters

string $entity_type_id: Name of the entity type for which a create form should be displayed.

Return value

array The processed form for a new entity_test.

See also

\Drupal\entity_test\Routing\EntityTestRoutes::routes()

File

core/modules/system/tests/modules/entity_test/src/Controller/EntityTestController.php, line 58
Contains \Drupal\entity_test\Controller\EntityTestController.

Class

EntityTestController
Controller routines for entity_test routes.

Namespace

Drupal\entity_test\Controller

Code

public function testAdd($entity_type_id) {
  $entity = entity_create($entity_type_id, array());
  $form = $this
    ->entityFormBuilder()
    ->getForm($entity);
  $form['#title'] = $this
    ->t('Create an @type', array(
    '@type' => $entity_type_id,
  ));
  return $form;
}