You are here

function _entity_rules_show_message in Entity Rules 7

Displays message with tokens replaced

Parameters

$text_value: Text value to be shown either format or plain string

$entity: Entity related to event

$entity_type:

$message_type: drupal_set_message type

1 call to _entity_rules_show_message()
_entity_rules_invoke_rules in ./entity_rules.module
Invokes Rules for an entity given an operation.

File

./entity_rules.module, line 993
Module file for the Entity Rules.

Code

function _entity_rules_show_message($text_value, $entity, $entity_type, $message_type = 'warning') {
  $is_filtered = FALSE;
  if (is_array($text_value)) {

    // We are dealing for a filtered text value
    $text = $text_value['value'];
    $format = $text_value['format'];
    $is_filtered = TRUE;
  }
  else {
    $text = check_plain($text_value);
  }
  if ($text == '<none>') {
    return '';
  }
  $token_types[] = 'global';
  $token_types[$entity_type] = $entity;
  $text = token_replace($text, $token_types);
  if ($is_filtered) {
    $text = check_markup($text, $format);
  }
  if ($text) {
    drupal_set_message($text, $message_type);
  }
}