You are here

function _popup_breadcrumb_title_attributes in Popup 6.x

1 call to _popup_breadcrumb_title_attributes()
popup_breadcrumb_preprocess_page in modules/popup_breadcrumb/popup_breadcrumb.module
Implementation of hook_preprocess_page

File

modules/popup_breadcrumb/includes/popup_breadcrumb.admin.inc, line 324

Code

function _popup_breadcrumb_title_attributes($title_type, $link_argument) {
  $space_link_argument = str_replace('-', ' ', $link_argument);
  $underscore_link_argument = str_replace('-', '_', $link_argument);
  $attributes = array();
  switch ($title_type) {
    case 'node':
      $result = db_fetch_array(db_query('SELECT title, nid FROM {node} WHERE title="%s" OR title="%s" OR title LIKE "%s" OR nid=%d', $link_argument, $space_link_argument, $underscore_link_argument, $link_argument));
      $attributes['title'] = $result['title'];
      $attributes['link'] = drupal_get_path_alias('node/' . $result['nid']);
      break;
    case 'user':
      $result = db_fetch_array(db_query('SELECT name, uid FROM {users} WHERE name="%s" OR name="%s" OR name LIKE "%s" OR uid=%d', $link_argument, $space_link_argument, $underscore_link_argument, $link_argument));
      $attributes['title'] = $result['name'];
      $attributes['link'] = drupal_get_path_alias('user/' . $result['nid']);
      break;
    case 'term':
      $result = db_fetch_array(db_query('SELECT name, tid FROM {term_data} WHERE name="%s" OR name="%s" OR name LIKE "%s" OR tid=%d', $link_argument, $space_link_argument, $underscore_link_argument, $link_argument));
      $attributes['title'] = $result['name'];
      $attributes['link'] = drupal_get_path_alias('taxonomy/term/' . $result['tid']);
      break;
  }
  return $attributes;
}