function theme_simplenews_admin_categories in Simplenews 7.2
Same name and namespace in other branches
- 7 includes/simplenews.admin.inc \theme_simplenews_admin_categories()
Form builder function, display a list of simplenews categories.
File
- includes/
simplenews.admin.inc, line 371 - 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'])) {
$newsletter =& $form[$key];
$row = array();
$row[] = drupal_render($newsletter['name']);
if (isset($newsletter['weight'])) {
$newsletter['weight']['#attributes']['class'] = array(
'simplenews-newsletter-weight',
);
$row[] = drupal_render($newsletter['weight']);
}
$row[] = drupal_render($newsletter['edit']);
$rows[] = array(
'data' => $row,
'class' => array(
'draggable',
),
);
}
}
$header = array(
t('Newsletter name'),
);
if (isset($form['submit'])) {
$header[] = t('Weight');
drupal_add_tabledrag('simplenews-newsletter', 'order', 'self', 'simplenews-newsletter-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 newsletter</a>.', array(
'@link' => url('admin/config/services/simplenews/add'),
)),
'attributes' => array(
'id' => 'simplenews-newsletter',
),
)) . drupal_render_children($form);
}