function theme_nodehierarchy_children_form in Node Hierarchy 6.3
Same name and namespace in other branches
- 6.2 nodehierarchy.module \theme_nodehierarchy_children_form()
- 7.4 nodehierarchy.admin.inc \theme_nodehierarchy_children_form()
- 7.2 nodehierarchy.module \theme_nodehierarchy_children_form()
Display the children tab form.
File
- ./
nodehierarchy.module, line 1147 - A module to make nodes hierarchical.
Code
function theme_nodehierarchy_children_form($form) {
drupal_add_tabledrag('children-list', 'order', 'sibling', 'menu-weight');
$colspan = module_exists('nodeaccess') ? '4' : '3';
$header = array(
t('Title'),
t('Type'),
t('Weight'),
array(
'data' => t('Operations'),
'colspan' => $colspan,
),
);
$rows = array();
foreach (element_children($form['children']) as $mlid) {
$element =& $form['children'][$mlid];
// Add special classes to be used for tabledrag.js.
$element['weight']['#attributes']['class'] = 'menu-weight';
$node = $element['node']['#value'];
$row = array();
$row[] = drupal_render($element['title']);
$row[] = drupal_render($element['type']);
$row[] = drupal_render($element['weight']);
$row[] = node_access('update', $node) ? l(t('edit'), 'node/' . $node->nid . '/edit') : '';
$row[] = node_access('delete', $node) ? l(t('delete'), 'node/' . $node->nid . '/delete') : '';
$row[] = nodehierarchy_children_tab_access($node) ? l(t('children'), 'node/' . $node->nid . '/children') : '';
if (module_exists('nodeaccess')) {
$row[] = nodeaccess_access('grant', $node) ? l(t('grant'), 'node/' . $node->nid . '/grant') : '';
}
$row = array(
'data' => $row,
);
$row['class'] = !empty($row['class']) ? $row['class'] . ' draggable' : 'draggable';
$rows[] = $row;
}
$output = '';
if ($rows) {
$output .= theme('table', $header, $rows, array(
'id' => 'children-list',
));
}
$output .= drupal_render($form);
return $output;
}