function ContentDevelGenerate::insertNodeData
1 call to ContentDevelGenerate::insertNodeData()
- ContentDevelGenerate::develGenerateContentAddNode in devel_generate/
src/ Plugin/ DevelGenerate/ ContentDevelGenerate.php - Create one node. Used by both batch and non-batch code branches.
File
-
devel_generate/
src/ Plugin/ DevelGenerate/ ContentDevelGenerate.php, line 769
Class
- ContentDevelGenerate
- Provides a ContentDevelGenerate plugin.
Namespace
Drupal\devel_generate\Plugin\DevelGenerateCode
private function insertNodeData(NodeInterface $node) : void {
if (!isset($node->devel_generate)) {
return;
}
$results = $node->devel_generate;
if (!empty($results['max_comments'])) {
foreach ($node->getFieldDefinitions() as $field_name => $field_definition) {
if ($field_definition->getType() !== 'comment') {
continue;
}
if ($node->get($field_name)
->getValue()[0]['status'] !== CommentItemInterface::OPEN) {
continue;
}
// Add comments for each comment field on entity.
$this->addNodeComments($node, $field_definition, $results['users'], $results['max_comments'], $results['title_length']);
}
}
if ($results['add_statistics']) {
$this->addNodeStatistics($node);
}
}