function theme_mostpopular_admin_intervals_table in Drupal Most Popular 7
Defines a theme function for rendering the intervals form.
Parameters
array $variables :
- form: The form to render.
1 theme call to theme_mostpopular_admin_intervals_table()
File
- ./
mostpopular.intervals.inc, line 243 - Provides an admin GUI for configuring intervals.
Code
function theme_mostpopular_admin_intervals_table($variables) {
$elements = $variables['element'];
$header = array(
'',
t('ID'),
array(
'data' => t('Title'),
'colspan' => 2,
),
t('Interval'),
t('Block'),
t('Weight'),
);
$rows = array();
$output = '';
foreach (element_children($elements) as $bid) {
$block = $elements[$bid];
$block['bid']['#attributes']['class'][] = 'mostpopular-block-bid';
$title = $block['#title'];
$rows[] = array(
'data' => array(
array(
'data' => '<strong>' . $title . '</strong>' . drupal_render($block['bid']),
'colspan' => 7,
),
),
);
foreach (element_children($block['intervals']) as $sid) {
$item = $block['intervals'][$sid];
// Add class to group weight fields for drag and drop
$item['bid']['#attributes']['class'][] = "mostpopular-bid";
$item['bid']['#attributes']['class'][] = "mostpopular-bid-{$bid}";
$item['weight']['#attributes']['class'][] = "mostpopular-weight";
$item['weight']['#attributes']['class'][] = "mostpopular-weight-{$bid}";
$row = array();
$row[] = array(
'data' => '',
'width' => 1,
);
$row[] = drupal_render($item['id']);
$row[] = array(
'data' => t('Past'),
'width' => '8',
);
$row[] = drupal_render($item['title']);
$row[] = drupal_render($item['string']);
$row[] = drupal_render($item['bid']);
$row[] = drupal_render($item['weight']);
$rows[] = array(
'data' => $row,
'class' => array(
'draggable',
),
);
}
$rows[] = array(
'data' => array(
array(
'data' => '',
'width' => 1,
),
array(
'data' => drupal_render($block['add_button']),
'colspan' => 6,
),
),
);
// Add tabledrag behavior to this region
drupal_add_tabledrag('mostpopular-admin-intervals', 'match', 'parent', 'mostpopular-bid', "mostpopular-bid-{$bid}", 'mostpopular-block-bid', FALSE);
drupal_add_tabledrag('mostpopular-admin-intervals', 'order', 'sibling', 'mostpopular-weight', "mostpopular-weight-{$bid}");
}
$output .= theme('table', array(
'header' => $header,
'rows' => $rows,
'attributes' => array(
'id' => 'mostpopular-admin-intervals',
),
));
drupal_add_css(drupal_get_path('module', 'mostpopular') . '/css/mostpopular-admin.css');
return $output;
}