function NodeSelection::createNewEntity
Overrides DefaultSelection::createNewEntity
File
- 
              core/modules/ node/ src/ Plugin/ EntityReferenceSelection/ NodeSelection.php, line 40 
Class
- NodeSelection
- Provides specific access control for the node entity type.
Namespace
Drupal\node\Plugin\EntityReferenceSelectionCode
public function createNewEntity($entity_type_id, $bundle, $label, $uid) {
  $node = parent::createNewEntity($entity_type_id, $bundle, $label, $uid);
  // In order to create a referenceable node, it needs to published.
  /** @var \Drupal\node\NodeInterface $node */
  $node->setPublished();
  return $node;
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
