function simple_node_importer_node_presave in Simple Node Importer 8
Same name and namespace in other branches
- 7 simple_node_importer.module \simple_node_importer_node_presave()
Implements hook_node_presave().
File
- ./
simple_node_importer.module, line 369 - Simple node importer module file.
Code
function simple_node_importer_node_presave(NodeInterface $node) {
if ($node
->getType() == "simple_node") {
if ($node->field_select_entity_type[0]->value == 'node') {
$selected_content_type = $node->field_select_content_type[0]->value;
}
else {
$selected_content_type = $node->field_select_entity_type[0]->value;
}
$created_date = date('mdY-H:i', $node
->getCreatedTime());
$node
->setTitle('Import-' . $selected_content_type . '-' . $created_date);
}
}