function views_attach_content_extra_fields in Views attach 6
Same name and namespace in other branches
- 6.2 views_attach.module \views_attach_content_extra_fields()
- 7.2 views_attach.module \views_attach_content_extra_fields()
Implementation of hook_content_extra_fields.
File
- ./
views_attach.module, line 15
Code
function views_attach_content_extra_fields($type_name) {
$extras = array();
$items = array();
// Build a list of just the views/displays that are relevant for this node type.
$views = views_attach_get_node_views($type_name);
foreach ($views as $mode => $info) {
foreach ($info as $entry) {
$items[] = $entry;
}
}
// Now add a weight field for each view/display.
foreach ($items as $item) {
if (!$item['title']) {
$item['title'] = t('Unnamed attached view');
}
$extras[$item['name'] . '_' . $item['display']] = array(
'label' => $item['title'],
'description' => t('Attached view.'),
'weight' => 10,
);
}
return $extras;
}