You are here

function theme_entityqueue_dragtable in Entityqueue 7

Themes the subqueue items as a dragtable.

1 theme call to theme_entityqueue_dragtable()
entityqueue_field_widget_form in ./entityqueue.module
Implements hook_field_widget_form().

File

includes/entityqueue.theme.inc, line 53
Contains theme implementations for the Entityqueue module.

Code

function theme_entityqueue_dragtable($variables) {
  $form = $variables['form'];
  drupal_add_css(drupal_get_path('module', 'entityqueue') . '/css/entityqueue.subquery_form.css', array(
    'type' => 'file',
  ));
  $output = '';
  $rows = array();
  $table_id = $form['#attributes']['id'];
  drupal_add_tabledrag($table_id, 'order', 'sibling', 'item-weight');
  foreach (element_children($form) as $key) {
    if (isset($form[$key]['label'])) {
      $row = array();
      $row[] = '<div class="container-inline">' . drupal_render($form[$key]['label']) . ' ' . drupal_render($form[$key]['entity_actions']) . '</div>';
      $row[] = drupal_render($form[$key]['actions']);
      $row[] = drupal_render($form[$key]['weight']);
      $rows[] = array(
        'data' => $row,
        'class' => array(
          'draggable',
        ),
      );
    }
  }
  if (empty($rows)) {
    $rows[] = array(
      array(
        'data' => t('No items.'),
        'colspan' => 3,
      ),
    );
  }
  $header = array(
    t('Label'),
    t('Actions'),
    t('Weight'),
  );
  $output .= theme('table', array(
    'header' => $header,
    'rows' => $rows,
    'attributes' => array(
      'id' => $table_id,
      'class' => $form['#attributes']['class'],
    ),
  ));
  return $output;
}