You are here

function acquia_lift_command_messagebox in Acquia Lift Connector 7.2

Same name and namespace in other branches
  1. 7 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.

5 calls to acquia_lift_command_messagebox()
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.
acquia_lift_goal_rename_complete_callback in ./acquia_lift.admin.unibar.inc
Ctools form processing complete handler for the renaming of a goal.
acquia_lift_goal_type_create_completed_callback in ./acquia_lift.admin.unibar.inc
Ctools form processing complete handler for the creation of a new goal by type.

File

./acquia_lift.module, line 3062
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,
    ),
  );
}