public function MultiNodeAddController::formPage in Multi Node Add 8
Content of the iframe with the modified node form.
1 string reference to 'MultiNodeAddController::formPage'
File
- src/
Controller/ MultiNodeAddController.php, line 41
Class
- MultiNodeAddController
- Controller for Multi Node Add.
Namespace
Drupal\multi_node_add\ControllerCode
public function formPage(NodeTypeInterface $node_type = NULL) {
$account = $this
->currentUser();
$langcode = $this
->moduleHandler()
->invoke('language', 'get_default_langcode', [
'node',
$node_type
->getOriginalId(),
]);
$node = $this
->entityTypeManager()
->getStorage('node')
->create([
'uid' => $account
->id(),
'name' => $account
->getAccountName() ?: '',
'type' => $node_type
->getOriginalId(),
'langcode' => $langcode ? $langcode : $this
->languageManager()
->getCurrentLanguage()
->getId(),
]);
$form = $this
->entityFormBuilder()
->getForm($node, 'default', [
'multi_node_add_hijacked' => TRUE,
]);
return $form;
}