function content_build_modes in Content Construction Kit (CCK) 6.2
Same name and namespace in other branches
- 6.3 content.module \content_build_modes()
Registry of available node build modes.
Parameters
$selector: Determines what information should be returned.
Return value
Depending on the value of the $selector parameter:
- NULL: a flat list of all available build modes.
The other two options are mainly used internally by CCK's UI:
- '_tabs': the list of tabs to be shown on the 'Display fields' screens.
- a string tab id: the build modes in this tab.
6 calls to content_build_modes()
- content_display_overview_form in includes/
content.admin.inc - Menu callback; presents a listing of fields display settings for a content type.
- content_instance_default_values in includes/
content.crud.inc - Create an array of default values for a field instance.
- content_menu in ./
content.module - Implementation of hook_menu().
- fieldgroup_group_edit_form in modules/
fieldgroup/ fieldgroup.module - field_group_default_settings in modules/
fieldgroup/ fieldgroup.module
File
- ./
content.module, line 1855 - Allows administrators to associate custom fields to content types.
Code
function content_build_modes($selector = NULL) {
static $info;
if (!isset($info)) {
$data = array();
foreach (module_implements('content_build_modes') as $module) {
$function = $module . '_content_build_modes';
$data = array_merge($data, (array) $function());
}
$flat = array();
foreach ($data as $tab) {
// Use the + operator to preserve numeric indexes (core build modes).
$flat += (array) $tab['build modes'];
}
$info = array(
'tabs' => $data,
'build modes' => $flat,
);
}
if ($selector === '_tabs') {
return $info['tabs'];
}
elseif (isset($selector) && isset($info['tabs'][$selector])) {
return isset($info['tabs'][$selector]) ? $info['tabs'][$selector]['build modes'] : array();
}
else {
return $info['build modes'];
}
}