function theme_book_helper_admin_table in Book helper 6
Same name and namespace in other branches
- 7 book_helper.admin.inc \theme_book_helper_admin_table()
Theme function for the book administration page form.
See also
book_admin_table()
1 theme call to theme_book_helper_admin_table()
- _book_helper_admin_table in ./
book_helper.admin.inc - Build the table portion of the form for the book administration page.
File
- ./
book_helper.admin.inc, line 362 - Administration page for the 'Book helper' module.
Code
function theme_book_helper_admin_table($form) {
// New code: Adds js to sync link title and node title.
drupal_add_js(drupal_get_path('module', 'book_helper') . '/book_helper.js');
drupal_add_tabledrag('book-outline', 'match', 'parent', 'book-plid', 'book-plid', 'book-mlid', TRUE, MENU_MAX_DEPTH - 2);
drupal_add_tabledrag('book-outline', 'order', 'sibling', 'book-weight');
/* Over-ridden code: Do not delete.
$header = array(t('Title'), t('Weight'), t('Parent'), array('data' => t('Operations'), 'colspan' => '3'));
*/
// Updated code: Adds hidden to header.
$header = array(
t('Menu title'),
t('Page title'),
array(
'data' => t('Sync'),
'class' => 'checkbox',
),
t('Weight'),
t('Parent'),
array(
'data' => t('Enabled'),
'class' => 'checkbox',
),
array(
'data' => t('Operations'),
'colspan' => '4',
),
);
$rows = array();
$destination = drupal_get_destination();
$access = user_access('administer nodes');
foreach (element_children($form) as $key) {
$nid = $form[$key]['nid']['#value'];
$href = $form[$key]['href']['#value'];
// Add special classes to be used with tabledrag.js.
$form[$key]['plid']['#attributes']['class'] = 'book-plid';
$form[$key]['mlid']['#attributes']['class'] = 'book-mlid';
$form[$key]['weight']['#attributes']['class'] = 'book-weight';
$data = array(
theme('indentation', $form[$key]['depth']['#value'] - 2) . drupal_render($form[$key]['title']),
// New code: Add node title and sync checkbox
drupal_render($form[$key]['node_title']),
array(
'data' => drupal_render($form[$key]['sync']),
'class' => 'checkbox',
),
drupal_render($form[$key]['weight']),
drupal_render($form[$key]['plid']) . drupal_render($form[$key]['mlid']),
// New code: Add hidden checkbox to table
array(
'data' => drupal_render($form[$key]['hidden']),
'class' => 'checkbox',
),
l(t('view'), $href),
$access ? l(t('edit'), 'node/' . $nid . '/edit', array(
'query' => $destination,
)) : ' ',
$access ? l(t('remove from book'), 'node/' . $nid . '/outline/remove', array(
'query' => $destination,
)) : ' ',
$access ? l(t('delete node'), 'node/' . $nid . '/delete', array(
'query' => $destination,
)) : ' ',
);
$row = array(
'data' => $data,
);
if (isset($form[$key]['#attributes'])) {
$row = array_merge($row, $form[$key]['#attributes']);
}
$row['class'] = empty($row['class']) ? 'draggable' : $row['class'] . ' draggable';
if (empty($form[$key]['hidden']['#value'])) {
$row['class'] .= ' hidden';
}
$rows[] = $row;
}
return theme('table', $header, $rows, array(
'id' => 'book-outline',
));
}