function theme_content_exclude in Content Construction Kit (CCK) 6.3
Same name and namespace in other branches
- 6.2 content.module \theme_content_exclude()
'Theme' function for a field's addition to $content.
Adapts the all-inclusive $content variable in node templates to allow some field content to be excluded. This is a theme function, so it can be overridden in different themes to produce different results.
The html for individual fields and groups are available in the $FIELD_NAME_rendered and $GROUP_NAME_rendered variables.
This allows more flexibility in node templates : you can use custom markup around a few specific fields, and print the rest of the node with $content.
Parameters
$content: The themed content for this field or group.
$object: The field or group array for this item. $object['#type_name'] holds the content type. $object['#field_name'] holds the field name (if a field). $object['#group_name'] holds the group name (if a group). $object['display_settings'] holds the display settings for all contexts, in an array like: $object['display_settings'] => array( 'full' => array( 'format' => 'default', 'exclude' => 0, ), 'teaser' => array( 'format' => 'default', 'exclude' => 1, ), );
$context: The context for which the node is being rendered. Can be one of the following values :
- 'teaser'
- 'full'
- NODE_BUILD_SEARCH_INDEX
- NODE_BUILD_SEARCH_RESULT
- NODE_BUILD_RSS
- NODE_BUILD_PRINT
- ... any other custom build mode exposed by 3rd party modules using hook_content_build_modes().
Return value
Whether or not content is to be added to $content in this context. Uses the value of the 'Exclude' checkbox for this field as set on the Manage fields screen.
2 theme calls to theme_content_exclude()
- content_field_wrapper_post_render in ./
content.module - Hide specified fields from the $content variable in node templates.
- fieldgroup_wrapper_post_render in modules/
fieldgroup/ fieldgroup.module - Hide specified fields from the $content variable in node templates.
File
- ./
content.module, line 2398 - Allows administrators to associate custom fields to content types.
Code
function theme_content_exclude($content, $object, $context) {
// The field may be missing info for $contexts added by modules
// enabled after the field was last edited.
if (empty($object['display_settings']) || empty($object['display_settings'][$context]) || !is_array($object['display_settings'][$context]) || empty($object['display_settings'][$context]['exclude'])) {
return FALSE;
}
else {
return TRUE;
}
}