function finder_views_path in Finder 6
Same name and namespace in other branches
- 7 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 - Implementation of 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 569 - 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(array(
'vid' => $id,
));
$path = 'node/' . $revision->nid . '/revisions/' . $id . '/view';
break;
case 'files':
$query = 'SELECT filepath FROM {files} f WHERE f.fid = %d';
$file = db_fetch_object(db_query($query, $id));
$path = $file->filepath;
break;
}
drupal_alter('finder_views_path', $path, $table, $id);
return $path;
}