function system_message_action

system_message_action(&$entity, $context = array())

Sends a message to the current user's screen.

Parameters

object $entity: An optional node object, which will be added as $context['node'] if provided.

array $context: Array with the following elements:

  • 'message': The message to send. This will be passed through token_replace().
  • Other elements will be used as the data for token replacement in the message.

Related topics

File

modules/system/system.module, line 3304
Configuration system that lets administrators modify the workings of the site.

Code

function system_message_action(&$entity, $context = array()) {
  if (empty($context['node'])) {
    $context['node'] = $entity;
  }

  $context['message'] = token_replace(filter_xss_admin($context['message']), $context);
  drupal_set_message($context['message']);
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!system!system.module/function/system_message_action/7.x