function theme_simplenews_admin_categories in Simplenews 7
Same name and namespace in other branches
- 7.2 includes/simplenews.admin.inc \theme_simplenews_admin_categories()
Form builder function, display a list of simplenews categories.
File
- includes/
simplenews.admin.inc, line 361 - Newsletter admin, subscription admin, simplenews settings
Code
function theme_simplenews_admin_categories($variables) {
$form = $variables['form'];
$rows = array();
foreach (element_children($form) as $key) {
if (isset($form[$key]['name'])) {
$category =& $form[$key];
$row = array();
$row[] = drupal_render($category['name']);
$row[] = drupal_render($category['count']);
if (isset($category['weight'])) {
$category['weight']['#attributes']['class'] = array(
'simplenews-category-weight',
);
$row[] = drupal_render($category['weight']);
}
$row[] = drupal_render($category['edit']);
$rows[] = array(
'data' => $row,
'class' => array(
'draggable',
),
);
}
}
$header = array(
t('Newsletter category name'),
);
$header[] = t('Subscribers');
if (isset($form['submit'])) {
$header[] = t('Weight');
drupal_add_tabledrag('newsletter-category', 'order', 'self', 'simplenews-category-weight');
}
$header[] = array(
'data' => t('Operations'),
'colspan' => '3',
);
return theme('table', array(
'header' => $header,
'rows' => $rows,
'empty' => t('No newsletter categories. <a href="@link">Add category</a>.', array(
'@link' => url('admin/config/services/simplenews/add'),
)),
'attributes' => array(
'id' => 'newsletter-category',
),
)) . drupal_render_children($form);
}