You are here

function node_convert_messages in Node Convert 7

Same name and namespace in other branches
  1. 6 node_convert.module \node_convert_messages()

Displays error messages if any occurred, otherwise the success message.

Parameters

$result: The result value of the node conversion. Possible values

  • FALSE Displays an error message.
  • Any other Displays success message.

$params: An array containing message parameters. Possible values

  • display_success If TRUE, the success message will be displayed, otherwise no message is displayed.

Default is TRUE.

3 calls to node_convert_messages()
node_convert_conversion_form_submit in ./node_convert.forms.inc
Submit callback for converting a form.
node_convert_convert_action in ./node_convert.module
Implements hook_action, exposing predefined conversion templates as actions.
node_convert_convert_nodes_using_template in ./node_convert.module
Converts a list of nodes using a given template

File

./node_convert.util.inc, line 268
API and Utility Functions.

Code

function node_convert_messages($result, $params = array()) {
  $params += array(
    'display_success' => TRUE,
  );
  $message_arguments = array(
    '@nid' => $params['nid'],
  );
  if ($result == FALSE) {
    $message = "Conversion failed for node nid @nid.";
    watchdog(NODE_CONVERT_WATCHDOG, $message, $message_arguments, WATCHDOG_ERROR);

    // @ignore security_3
    drupal_set_message(t($message, $message_arguments), 'error');
  }
  elseif ($params['display_success'] == TRUE) {
    $message = 'Node @nid has been converted successfully.';

    // @ignore security_3
    drupal_set_message(t($message, $message_arguments));
    watchdog(NODE_CONVERT_WATCHDOG, $message, $message_arguments, WATCHDOG_INFO);
  }
}