function message_example_node_insert in Message 8
Same name and namespace in other branches
- 7 message_example/message_example.module \message_example_node_insert()
Implements hook_node_insert().
File
- modules/
message_example/ message_example.module, line 17 - Holds hook implementation for the Message example module.
Code
function message_example_node_insert(Node $node) {
$message = Message::create([
'template' => 'example_create_node',
'uid' => $node
->get('uid'),
]);
$message
->set('field_node_reference', $node);
$message
->set('field_published', $node
->isPublished());
$message
->save();
}