Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
This include file for the modules Views (/modules/views/modules/views_userlink.inc) implements views functionality for userlink.module.
/**
* $Id: views_userlink.inc,v 1.10 2006/06/21 12:01:19 chris_five Exp $
*/
function userlink_views_tables() {
if (module_exist('userlink')) {
$tables['userlink'] = array(
'name' => 'userlink',
'provider' => 'internal',
'join' => array(
'left' => array(
'table' => 'node',
'field' => 'nid'
),
'right' => array(
'field' => 'nid'
),
),
'fields' => array(
'url' => array(
'name' => t('Userlink: URL'),
'handler' => 'views_handler_userlink_url',
'sortable' => false,
'help' => t("The URL field will display the URL of a userlink node (for example, 'http://www.drupal.org')")
),
)
);
return $tables;
}
}
function views_handler_userlink_url($fieldinfo, $fielddata, $value, $data) {
return l($value, $value);
}
Based on work by vadbars (http://drupal.org/node/68931)
Comments
Change of function name in Drupal 5
You must replace "module_exist" function to "module_exists" in order to make this snippet work on Drupal 5.
http://drupal.org/node/64279#module-exists
Diego.
No Longer necessary
The latest version of userlink module (5.x-1.2) already support integration with views.
Using the code in this page will result in Fatal error: Cannot redeclare userlink_views_tables()
Thanks
Oh, I remember facing this problem when building file upload web service.
Thank you for this post.