nd_permalink.module in Node displays 6.2
The ND Permalink module provides a new field for node displays which renders a field containing a permalink to the current object.
File
modules/nd_permalink/nd_permalink.moduleView source
<?php
/**
* @file
* The ND Permalink module provides a new field for node displays which renders
* a field containing a permalink to the current object.
*/
/**
* Implementation of hook_ds_fields().
*/
function nd_permalink_ds_fields($type_name, $build_mode, $extra) {
// Node fields
$nd_fields = array();
$nd_fields['nd'] = array();
$nd_fields['nd']['permalink'] = array(
'title' => t('Permalink'),
'type' => DS_FIELD_TYPE_THEME,
'status' => DS_FIELD_STATUS_STATIC,
'properties' => array(
'formatters' => array(
'nd_permalink_permalink' => t('Permalink'),
),
),
);
return $nd_fields;
}
function theme_nd_permalink_permalink($element) {
return l('Permanent link to this page', 'node/' . $element['object']->nid, array(
'absolute' => TRUE,
'alias' => TRUE,
));
}
/**
* Implements hook_theme().
*/
function nd_permalink_theme($existing, $type, $theme, $path) {
return array(
'nd_permalink_permalink' => array(
'arguments' => array(
'element' => NULL,
),
),
);
}
Functions
Name | Description |
---|---|
nd_permalink_ds_fields | Implementation of hook_ds_fields(). |
nd_permalink_theme | Implements hook_theme(). |
theme_nd_permalink_permalink |