function node_publish_action

Sets the status of a node to 1 (published).

Parameters

Drupal\node\Node $node: A node entity.

$context: (optional) Array of additional information about what triggered the action. Not used for this action.

Related topics

File

drupal/core/modules/node/node.module, line 3465
The core module that allows content to be submitted to the site.

Code

function node_publish_action(Node $node, $context = array()) {
  $node->status = NODE_PUBLISHED;
  watchdog('action', 'Set @type %title to published.', array(
    '@type' => node_get_type_label($node),
    '%title' => $node
      ->label(),
  ));
}