function content_extra_field_weight in Content Construction Kit (CCK) 6
Same name and namespace in other branches
- 6.3 content.module \content_extra_field_weight()
- 6.2 content.module \content_extra_field_weight()
Retrieve the user-defined weight for non-CCK node 'fields'.
CCK's 'Manage fields' page lets users reorder node fields, including non-CCK items (body, taxonomy, other hook_nodeapi-added elements by contrib modules...). Contrib modules that want to have their 'fields' supported need to expose them with hook_content_extra_fields, and use this function to retrieve the user-defined weight.
Parameters
$type_name: The content type name.
$pseudo_field_name: The name of the 'field'.
Return value
The weight for the 'field', respecting the user settings stored by content.module.
File
- ./
content.module, line 1949 - Allows administrators to associate custom fields to content types.
Code
function content_extra_field_weight($type_name, $pseudo_field_name) {
$type = content_types($type_name);
// If we don't have the requested item, this may be because the cached
// information for 'extra' fields hasn't been refreshed yet.
if (!isset($type['extra'][$pseudo_field_name])) {
content_clear_type_cache();
}
if (isset($type['extra'][$pseudo_field_name])) {
return $type['extra'][$pseudo_field_name]['weight'];
}
}