function noderelationships_content_extra_fields in Node Relationships 6
Implementation of hook_content_extra_fields().
File
- ./
noderelationships.module, line 256 - This is the main script for the noderelationships module. It merely contains the implementation of hooks invoked by Drupal core, CCK, Views, etc. All common functions are externalized into several scripts that are included on demand.
Code
function noderelationships_content_extra_fields($nodetype) {
$extra = array();
// Include common module functions.
module_load_include('inc', 'noderelationships');
// Obtain back reference settings for this type.
$backref_settings = noderelationships_settings_load($nodetype, 'backref');
$backref_regions = $backref_settings['regions'];
if (!empty($backref_regions[NODERELATIONSHIPS_BACKREF_REGION_PAGE])) {
$type_names = array();
foreach (array_keys($backref_regions[NODERELATIONSHIPS_BACKREF_REGION_PAGE]) as $relation_key) {
list($type_name, $field_name) = explode(':', $relation_key);
if (!isset($type_names[$type_name])) {
$type_names[$type_name] = noderelationships_get_localized_content_type_name($type_name);
}
}
// Sort types alphabetically.
uksort($type_names, '_noderelationships_sort_strncmp');
$extra['noderelationships'] = array(
'label' => t('Node relationships'),
'description' => t('Back reference views for the following types: @types.', array(
'@types' => implode(', ', $type_names),
)),
'weight' => noderelationships_get_element_weight($nodetype),
);
}
return $extra;
}