You are here

public function NodeController::add in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/node/src/Controller/NodeController.php \Drupal\node\Controller\NodeController::add()

Provides the node submission form.

Parameters

\Drupal\node\NodeTypeInterface $node_type: The node type entity for the node.

Return value

array A node submission form.

1 string reference to 'NodeController::add'
node.routing.yml in core/modules/node/node.routing.yml
core/modules/node/node.routing.yml

File

core/modules/node/src/Controller/NodeController.php, line 113
Contains \Drupal\node\Controller\NodeController.

Class

NodeController
Returns responses for Node routes.

Namespace

Drupal\node\Controller

Code

public function add(NodeTypeInterface $node_type) {
  $node = $this
    ->entityManager()
    ->getStorage('node')
    ->create(array(
    'type' => $node_type
      ->id(),
  ));
  $form = $this
    ->entityFormBuilder()
    ->getForm($node);
  return $form;
}