function _nd_register_build_modes in Node displays 6
Register build modes.
1 call to _nd_register_build_modes()
- nd_get_build_modes in ./
nd.module - Api function to return all build modes.
File
- includes/
nd.registry.inc, line 155 - Registry functions.
Code
function _nd_register_build_modes() {
// Define array with build modes to exclude.
$exclude_build_modes = array(
NODE_BUILD_SEARCH_INDEX,
'token',
);
// Build modes defined in hooks.
$weight = 10;
$build_modes = array();
foreach (module_implements('content_build_modes') as $module) {
$module_data = array();
$function = $module . '_content_build_modes';
$temp_data = $function();
// We need to do some fiddling existing build modes.
foreach ($temp_data as $tab_key => $value) {
foreach ($value['build modes'] as $key => $value2) {
// Exclude some build modes.
if (in_array($key, $exclude_build_modes)) {
continue;
}
// Sane build modes.
$module_data[$key] = array(
'weight' => isset($value['weight']) ? $value['weight'] : $weight++,
'title' => $value2['title'],
'build modes' => array(
$key => array(
'title' => $value2['title'],
),
),
);
// Check on Full node for its weight.
if ($value2['title'] == t('Full node')) {
$module_data[$key]['weight'] = -1;
}
}
}
// Merge the result
$build_modes += $module_data;
}
// Give modules a change to alter build_modes.
drupal_alter('nd_buildmodes', $build_modes);
// Let's order.
asort($build_modes);
// Cache all build modes.
variable_set('nd_all_build_modes', $build_modes);
return $build_modes;
}