NodeController::add

public NodeController::add(NodeTypeInterface $node_type)

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.

File

core/modules/node/src/Controller/NodeController.php, line 108

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;
}
doc_Drupal
2016-10-29 09:30:37
Comments
Leave a Comment

Please login to continue.