You are here

function _popup_title in Popup 7

Same name and namespace in other branches
  1. 8 includes/popup.util.inc \_popup_title()
1 call to _popup_title()
popup_element in includes/popup.api.inc
Renders a popup elements' HTML

File

includes/popup.util.inc, line 6

Code

function _popup_title($title, $path) {
  if ($path) {
    global $theme;
    $theme_path = drupal_get_path('theme', $theme) . '/' . $path;
    $files_path = file_default_scheme() . '://' . $path;
    $candidates = array_keys(array_filter(array(
      $path => file_exists(realpath($path)),
      // Relative to drupal install
      file_create_url($files_path) => file_exists(drupal_realpath($files_path)),
      // Relative to the files folder
      $theme_path => file_exists(realpath($theme_path)),
    )));
    $url = array_shift($candidates);
    $title = '<img src="/' . $url . '" alt="' . $title . '" />';
  }
  return $title;
}