You are here

function acquia_lift_command_messagebox in Acquia Lift Connector 7

Same name and namespace in other branches
  1. 7.2 acquia_lift.module \acquia_lift_command_messagebox()

Returns an AJAX command to display a message box.

Parameters

$message: The string message to display. This message may include HTML text.

$seconds: (optional) The number of seconds before the message box should be hidden. If 0 (default) then the box is shown until the user clicks to close it.

Return value

array A command array that can be returned via AJAX.

9 calls to acquia_lift_command_messagebox()
acquia_lift_campaign_start_complete_callback in ./acquia_lift.admin.unibar.inc
Form complete callback for the acquia_lift_campaign_start_form form.
acquia_lift_campaign_type_create_complete_callback in ./acquia_lift.admin.unibar.inc
Ctools form processing complete handler for the creation of a new campaign by type.
acquia_lift_element_variation_delete_complete_callback in ./acquia_lift.admin.unibar.inc
Ctools form processing complete handler for deletion of an element variation.
acquia_lift_element_variation_details_form_ajax_callback in ./acquia_lift.admin.unibar.inc
Responds to AJAX submission of a variation type details page.
acquia_lift_goal_delete_complete_callback in ./acquia_lift.admin.unibar.inc
Ctools form processing complete handler for deletion of a goal.

... See full list

File

./acquia_lift.module, line 2825
acquia_lift.module Provides Acquia Lift-specific personalization functionality.

Code

function acquia_lift_command_messagebox($message, $seconds = 0) {
  if (is_array($message)) {
    $message = drupal_render($message);
  }

  // Add any messages set by drupal_set_message().
  $full_message = '';
  $queued_messages = drupal_get_messages();
  $delimiter = '<br />';
  foreach ($queued_messages as $messages) {
    $full_message .= implode($messages, $delimiter);
  }
  if (!empty($message)) {
    if (!empty($full_message)) {
      $full_message .= $delimiter;
    }
    $full_message .= $message;
  }
  return array(
    'command' => 'acquia_lift_message_box',
    'data' => array(
      'message' => $full_message,
      'seconds' => $seconds,
    ),
  );
}