2007-08-30 16:27:12 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file
|
2008-12-30 16:43:20 +00:00
|
|
|
* Administrative page callbacks for menu module.
|
2007-08-30 16:27:12 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2010-04-13 15:23:03 +00:00
|
|
|
* Returns HTML for the menu overview form into a table.
|
|
|
|
*
|
|
|
|
* @param $variables
|
|
|
|
* An associative array containing:
|
|
|
|
* - form: A render element representing the form.
|
2007-12-06 09:58:34 +00:00
|
|
|
*
|
|
|
|
* @ingroup themeable
|
2007-08-30 16:27:12 +00:00
|
|
|
*/
|
2009-10-09 01:00:08 +00:00
|
|
|
function theme_menu_overview_form($variables) {
|
|
|
|
$form = $variables['form'];
|
|
|
|
|
2007-11-26 16:19:37 +00:00
|
|
|
drupal_add_tabledrag('menu-overview', 'match', 'parent', 'menu-plid', 'menu-plid', 'menu-mlid', TRUE, MENU_MAX_DEPTH - 1);
|
2007-11-20 10:18:43 +00:00
|
|
|
drupal_add_tabledrag('menu-overview', 'order', 'sibling', 'menu-weight');
|
|
|
|
|
|
|
|
$header = array(
|
2009-03-20 19:18:11 +00:00
|
|
|
t('Menu link'),
|
2009-08-22 14:34:23 +00:00
|
|
|
array('data' => t('Enabled'), 'class' => array('checkbox')),
|
2007-11-20 10:18:43 +00:00
|
|
|
t('Weight'),
|
2012-10-09 19:49:07 +00:00
|
|
|
t('Operations'),
|
2007-11-20 10:18:43 +00:00
|
|
|
);
|
|
|
|
|
2007-11-09 22:14:41 +00:00
|
|
|
$rows = array();
|
|
|
|
foreach (element_children($form) as $mlid) {
|
|
|
|
if (isset($form[$mlid]['hidden'])) {
|
|
|
|
$element = &$form[$mlid];
|
|
|
|
|
2007-11-20 10:18:43 +00:00
|
|
|
// Add special classes to be used for tabledrag.js.
|
2009-08-22 14:34:23 +00:00
|
|
|
$element['plid']['#attributes']['class'] = array('menu-plid');
|
|
|
|
$element['mlid']['#attributes']['class'] = array('menu-mlid');
|
|
|
|
$element['weight']['#attributes']['class'] = array('menu-weight');
|
2007-11-20 10:18:43 +00:00
|
|
|
|
|
|
|
// Change the parent field to a hidden. This allows any value but hides the field.
|
|
|
|
$element['plid']['#type'] = 'hidden';
|
|
|
|
|
2013-06-14 22:56:38 +00:00
|
|
|
$indent = array(
|
|
|
|
'#theme' => 'indentation',
|
|
|
|
'#size' => $element['#item']['depth'] - 1,
|
|
|
|
);
|
|
|
|
|
2007-11-09 22:14:41 +00:00
|
|
|
$row = array();
|
2013-06-14 22:56:38 +00:00
|
|
|
$row[] = drupal_render($indent) . drupal_render($element['title']);
|
2009-10-09 17:16:46 +00:00
|
|
|
$row[] = array('data' => drupal_render($element['hidden']), 'class' => array('checkbox', 'menu-enabled'));
|
2007-11-20 10:18:43 +00:00
|
|
|
$row[] = drupal_render($element['weight']) . drupal_render($element['plid']) . drupal_render($element['mlid']);
|
2012-10-09 19:49:07 +00:00
|
|
|
$row[] = drupal_render($element['operations']);
|
2007-08-30 16:27:12 +00:00
|
|
|
|
2007-11-09 22:14:41 +00:00
|
|
|
$row = array_merge(array('data' => $row), $element['#attributes']);
|
2009-08-22 14:34:23 +00:00
|
|
|
$row['class'][] = 'draggable';
|
2007-11-09 22:14:41 +00:00
|
|
|
$rows[] = $row;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$output = '';
|
2009-06-27 23:49:19 +00:00
|
|
|
if (empty($rows)) {
|
|
|
|
$rows[] = array(array('data' => $form['#empty_text'], 'colspan' => '7'));
|
2007-11-09 22:14:41 +00:00
|
|
|
}
|
2013-06-14 22:56:38 +00:00
|
|
|
|
|
|
|
$table = array(
|
|
|
|
'#theme' => 'table',
|
|
|
|
'#header' => $header,
|
|
|
|
'#rows' => $rows,
|
|
|
|
'#attributes' => array(
|
|
|
|
'id' => 'menu-overview',
|
|
|
|
),
|
|
|
|
);
|
|
|
|
|
2013-02-01 16:21:13 +00:00
|
|
|
$output .= drupal_render($form['inline_actions']);
|
2013-06-14 22:56:38 +00:00
|
|
|
$output .= drupal_render($table);
|
2009-02-03 18:55:32 +00:00
|
|
|
$output .= drupal_render_children($form);
|
2007-11-09 22:14:41 +00:00
|
|
|
return $output;
|
2007-08-30 16:27:12 +00:00
|
|
|
}
|