You are here

function finder_views_path in Finder 7

Same name and namespace in other branches
  1. 6 modules/finder_views/finder_views.module \finder_views_path()

Get the raw link to an object given the table and id.

You would think Drupal or Views would provide this feature? :(

Parameters

$table: Base table for this type of object.

$id: The value of the primary key for this record.

Return value

A raw path that can be put into url() or l() that can be used to link to or redirect to the object.

2 calls to finder_views_path()
finder_views_finder_goto in modules/finder_views/finder_views.module
Implements hook_finder_goto().
theme_finder_views_results in modules/finder_views/finder_views.module
Theme the views finder results.

File

modules/finder_views/finder_views.module, line 573
The finder views module.

Code

function finder_views_path($table, $id) {
  switch ($table) {
    case 'node':
      $path = 'node/' . $id;
      break;
    case 'users':
      $path = 'user/' . $id;
      break;
    case 'term_data':
      $path = 'taxonomy/term/' . $id;
      break;
    case 'node_revisions':
      $revision = node_load(NULL, $id);
      $path = 'node/' . $revision->nid . '/revisions/' . $id . '/view';
      break;
    case 'files':
      $path = file_load($id)->uri;
      break;
  }
  drupal_alter('finder_views_path', $path, $table, $id);
  return $path;
}