You are here

function theme_simple_access_profile_list in Simple Access 7.2

Same name and namespace in other branches
  1. 5.2 simple_access.module \theme_simple_access_profile_list()
  2. 6.2 simple_access.theme.inc \theme_simple_access_profile_list()

Theme a list of simple access profiles as draggable table.

File

./simple_access.theme.inc, line 102
Provide themes for simple access administration.

Code

function theme_simple_access_profile_list($form) {
  drupal_add_tabledrag('sa-profile-list', 'order', 'sibling', 'sa-profile-weight');
  $options = array(
    'header' => array(
      t('Name'),
      t('Weight'),
      t('Operations'),
    ),
    'rows' => array(),
    'attributes' => array(
      'id' => 'sa-profile-list',
    ),
  );
  $output = '';
  foreach (element_children($form['form']['profiles']) as $id) {
    $options['rows'][] = array(
      'data' => array(
        array(
          'data' => drupal_render($form['form']['profiles'][$id]['name']),
        ),
        array(
          'data' => drupal_render($form['form']['profiles'][$id]['weight']),
        ),
        array(
          'data' => drupal_render($form['form']['profiles'][$id]['operations']),
        ),
      ),
      'class' => array(
        'draggable',
      ),
    );
  }
  if (empty($options['rows'])) {
    $options['rows'][] = array(
      array(
        'data' => t('No profiles defined'),
        'colspan' => 3,
        'align' => 'center',
      ),
    );
  }
  $output .= theme('table', $options);
  return $output;
}