Modal messages

Categories

Component ID

1972848

Component name

Modal messages

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Downloads

798

Component created

Component changed

Component body

This module enables to add Drupal messages of special types (by drupal_set_message() or from rules). These messages are shown in ctools popup window.

The module can show popup window with messages without AJAX context, just on a page load, but the main purpose of the module is to show messages after closing other popup windows (for example, popup windows with forms). In this case, you should do something like this:

  $commands = ctools_modal_form_wrapper('some_form', $form_state);
  if (!empty($form_state['executed']) && empty($form_state['rebuild'])) {
    $commands = array();
    ctools_add_js('ajax-responder');
    $commands[] = ctools_modal_command_dismiss();
    $modal_commands = array();
    if (module_exists('modal_messages')) {
      $modal_commands = modal_messages_get_as_ajax_commands($force_page_reload);
    }
    if (!empty($modal_commands)) {
      foreach ($modal_commands as $command) {
        $commands[] = $command;
      }
    }
    elseif ($force_page_reload) {
      $commands[] = ctools_ajax_command_reload();
    }
    print ajax_render($commands);
    exit;
  }