public function DemoTaxonomyTerm::createContent in Open Social 8.8
Same name and namespace in other branches
- 8.9 modules/custom/social_demo/src/DemoTaxonomyTerm.php \Drupal\social_demo\DemoTaxonomyTerm::createContent()
- 8 modules/custom/social_demo/src/DemoTaxonomyTerm.php \Drupal\social_demo\DemoTaxonomyTerm::createContent()
- 8.2 modules/custom/social_demo/src/DemoTaxonomyTerm.php \Drupal\social_demo\DemoTaxonomyTerm::createContent()
- 8.3 modules/custom/social_demo/src/DemoTaxonomyTerm.php \Drupal\social_demo\DemoTaxonomyTerm::createContent()
- 8.4 modules/custom/social_demo/src/DemoTaxonomyTerm.php \Drupal\social_demo\DemoTaxonomyTerm::createContent()
- 8.5 modules/custom/social_demo/src/DemoTaxonomyTerm.php \Drupal\social_demo\DemoTaxonomyTerm::createContent()
- 8.6 modules/custom/social_demo/src/DemoTaxonomyTerm.php \Drupal\social_demo\DemoTaxonomyTerm::createContent()
- 8.7 modules/custom/social_demo/src/DemoTaxonomyTerm.php \Drupal\social_demo\DemoTaxonomyTerm::createContent()
- 10.3.x modules/custom/social_demo/src/DemoTaxonomyTerm.php \Drupal\social_demo\DemoTaxonomyTerm::createContent()
- 10.0.x modules/custom/social_demo/src/DemoTaxonomyTerm.php \Drupal\social_demo\DemoTaxonomyTerm::createContent()
- 10.1.x modules/custom/social_demo/src/DemoTaxonomyTerm.php \Drupal\social_demo\DemoTaxonomyTerm::createContent()
- 10.2.x modules/custom/social_demo/src/DemoTaxonomyTerm.php \Drupal\social_demo\DemoTaxonomyTerm::createContent()
Creates content.
Return value
array An array with list of created entities.
Overrides DemoContentInterface::createContent
1 call to DemoTaxonomyTerm::createContent()
- EventType::createContent in modules/
custom/ social_demo/ src/ Plugin/ DemoContent/ EventType.php - Creates content.
1 method overrides DemoTaxonomyTerm::createContent()
- EventType::createContent in modules/
custom/ social_demo/ src/ Plugin/ DemoContent/ EventType.php - Creates content.
File
- modules/
custom/ social_demo/ src/ DemoTaxonomyTerm.php, line 39
Class
- DemoTaxonomyTerm
- Class DemoTaxonomyTerm.
Namespace
Drupal\social_demoCode
public function createContent($generate = FALSE, $max = NULL) {
$data = $this
->fetchData();
if ($generate === TRUE) {
$data = $this
->scrambleData($data, $max);
}
foreach ($data as $uuid => $item) {
// Must have uuid and same key value.
if ($uuid !== $item['uuid']) {
drush_log(dt("Term with uuid: {$uuid} has a different uuid in content."), LogLevel::ERROR);
continue;
}
// Check whether node with same uuid already exists.
$terms = $this->entityStorage
->loadByProperties([
'uuid' => $uuid,
]);
if ($terms) {
drush_log(dt("Term with uuid: {$uuid} already exists."), LogLevel::WARNING);
continue;
}
$entry = $this
->getEntry($item);
$entity = $this->entityStorage
->create($entry);
$entity
->save();
if ($entity
->id()) {
$this->content[$entity
->id()] = $entity;
}
}
return $this->content;
}