You are here

API.txt in Popups API (Ajax Dialogs) 6.2

Same filename and directory in other branches
  1. 6 API.txt
As well as attaching popup behavior to links,
Popups API provides javascript function for creating in-window popup messages.

Popups.message(title, message)
  Produces a simple modal box with the title, message and "OK", "Cancel" buttons.

Popups.open(title, body, buttons, width)
  More powerful, allows you to specify what the buttons are and what they do.
  buttons is a hash of hash, with button title and function.
  * Example:
  Drupal.popups.open(
    Drupal.t('Warning: Please Confirm'),
    Drupal.t("There are unsaved changes on this page, which you will lose if you continue."),
    {
      'popup_save': {
        title: Drupal.t('Save Changes'),
        func: function(){Drupal.popups.savePage(element, options);}
      },
      'popup_submit': {
        title: Drupal.t('Continue'),
        func: function(){Drupal.popups.removePopup(); Drupal.popups.openPath(element, options);}
      },
      'popup_cancel': {
        title: Drupal.t('Cancel'), func: Drupal.popups.close;
      }
    }
  );

// TODO - make a more useful api function for opening a path.
Popups.openPath = function(element, options, parent)
 * @param element
 *   Element that was clicked to open the popups.
 * @param options
 *   Hash of options controlling how the popups interacts with the underlying page.
 * @param parent
 *   If path is being opened from inside another popup, that popup is the parent.

File

API.txt
View source
  1. As well as attaching popup behavior to links,
  2. Popups API provides javascript function for creating in-window popup messages.
  3. Popups.message(title, message)
  4. Produces a simple modal box with the title, message and "OK", "Cancel" buttons.
  5. Popups.open(title, body, buttons, width)
  6. More powerful, allows you to specify what the buttons are and what they do.
  7. buttons is a hash of hash, with button title and function.
  8. * Example:
  9. Drupal.popups.open(
  10. Drupal.t('Warning: Please Confirm'),
  11. Drupal.t("There are unsaved changes on this page, which you will lose if you continue."),
  12. {
  13. 'popup_save': {
  14. title: Drupal.t('Save Changes'),
  15. func: function(){Drupal.popups.savePage(element, options);}
  16. },
  17. 'popup_submit': {
  18. title: Drupal.t('Continue'),
  19. func: function(){Drupal.popups.removePopup(); Drupal.popups.openPath(element, options);}
  20. },
  21. 'popup_cancel': {
  22. title: Drupal.t('Cancel'), func: Drupal.popups.close;
  23. }
  24. }
  25. );
  26. // TODO - make a more useful api function for opening a path.
  27. Popups.openPath = function(element, options, parent)
  28. * @param element
  29. * Element that was clicked to open the popups.
  30. * @param options
  31. * Hash of options controlling how the popups interacts with the underlying page.
  32. * @param parent
  33. * If path is being opened from inside another popup, that popup is the parent.