1 node.api.php hook_node_prepare(Node $node)

Act on a node object about to be shown on the add/edit form.

This hook is invoked from node_object_prepare() after the type-specific hook_prepare() is invoked.

Parameters

Node $node: The node that is about to be shown on the add/edit form.

Related topics

File

core/modules/node/node.api.php, line 597
Hooks provided by the Node module.

Code

function hook_node_prepare(Node $node) {
  if (!isset($node->comment)) {
    $node->my_setting = config_get('my_module.settings', 'my_setting');
  }
}