You are here

function _popup_id in Popup 7

Same name and namespace in other branches
  1. 8 includes/popup.util.inc \_popup_id()
  2. 7.x includes/popup.util.inc \_popup_id()
  3. 6.x includes/popup.util.inc \_popup_id()

Generates a unique id for a popup element.

1 call to _popup_id()
popup_element in includes/popup.api.inc
Renders a popup elements' HTML

File

includes/popup.util.inc, line 93

Code

function _popup_id($id = FALSE) {
  static $ids = array();
  static $popup_index = 0;
  if ($id) {
    $offset = 0;
    $offset_id = $id . '-' . $offset;
    while (isset($ids[$offset_id])) {
      $offset_id = $id . '-' . $offset++;
    }
    $ids[$offset_id] = TRUE;
    return $offset_id;
  }
  return 'popup-element-' . $popup_index++;
}