function _content_overview_order in Content Construction Kit (CCK) 6.2
Same name and namespace in other branches
- 6.3 includes/content.admin.inc \_content_overview_order()
Helper function to order fields and groups when theming (preprocessing) overview forms.
The $form is passed by reference because we assign depths as parenting relationships are sorted out.
3 calls to _content_overview_order()
- template_preprocess_content_copy_export_form in modules/
content_copy/ content_copy.module - template_preprocess_content_display_overview_form in theme/
theme.inc - Theme preprocess function for content-admin-display-overview-form.tpl.php.
- template_preprocess_content_field_overview_form in theme/
theme.inc - @file Theme preprocess function for content-admin-field-overview-form.tpl.php.
File
- includes/
content.admin.inc, line 1651 - Administrative interface for content type creation.
Code
function _content_overview_order(&$form, $field_rows, $group_rows) {
// Put weight and parenting values into a $dummy render structure
// and let drupal_render figure out the corresponding row order.
$dummy = array();
// Group rows: account for weight.
if (module_exists('fieldgroup')) {
foreach ($group_rows as $name) {
$dummy[$name] = array(
'#weight' => $form[$name]['weight']['#value'],
'#value' => $name . ' ',
);
}
}
// Field rows : account for weight and parenting.
foreach ($field_rows as $name) {
$dummy[$name] = array(
'#weight' => $form[$name]['weight']['#value'],
'#value' => $name . ' ',
);
if (module_exists('fieldgroup')) {
if ($parent = $form[$name]['parent']['#value']) {
$form[$name]['#depth'] = 1;
$dummy[$parent][$name] = $dummy[$name];
unset($dummy[$name]);
}
}
}
return $dummy ? explode(' ', trim(drupal_render($dummy))) : array();
}