Skip to content
Snippets Groups Projects

Issue #3189189 by tsega: Auto create title if not provided

1 file
+ 3
0
Compare changes
  • Side-by-side
  • Inline
@@ -198,6 +198,9 @@ class ExcelImporterForm extends FormBase {
foreach($sheet_data as $sheet_content_types) {
foreach($sheet_content_types as $sheet_content_type) {
$node = \Drupal::entityTypeManager()->getStorage('node')->create($sheet_content_type);
if(!strlen(trim($node->getTitle()))) {
$node->setTitle($node->type->entity->label() . ' ' . date('Y-m-d'));
}
$node->save();
$saved_entities++;
}
Loading