You are here

function theme_alinks_list in Alinks 7

Same name and namespace in other branches
  1. 6 alinks.module \theme_alinks_list()

Theme function for the list of alinks

File

./alinks.module, line 464
this module allows users to associates defined text to links

Code

function theme_alinks_list($form) {
  $header = array(
    t('Start'),
    t('String'),
    t('End'),
    t('Case'),
    t('URL'),
    t('URL title'),
    t('External'),
    t('Class'),
    t('Weight'),
    t('Delete'),
  );
  $table_drag_weight_cls = 'alinks-weight';
  $rows = array();

  // We need only first argument of array
  $form = array_shift($form);
  foreach ($form['alinks']['#value'] as $id => $alink) {
    $rows[] = array(
      'data' => array(
        drupal_render($form['edit_alink'][$alink->id]['start_boundary_edit']),
        drupal_render($form['edit_alink'][$alink->id]['word_edit']),
        drupal_render($form['edit_alink'][$alink->id]['end_boundary_edit']),
        drupal_render($form['edit_alink'][$alink->id]['case_insensitive_edit']),
        drupal_render($form['edit_alink'][$alink->id]['url_edit']),
        drupal_render($form['edit_alink'][$alink->id]['url_title_edit']),
        drupal_render($form['edit_alink'][$alink->id]['external_edit']),
        drupal_render($form['edit_alink'][$alink->id]['class_edit']),
        drupal_render($form['edit_alink'][$alink->id]['weight_edit']),
        drupal_render($form['edit_alink'][$alink->id]['delete']),
      ),
      'class' => array(
        'draggable',
      ),
    );
  }
  $output = theme('table', array(
    'header' => $header,
    'rows' => $rows,
    'attributes' => array(
      'id' => 'alinks-table',
    ),
  ));
  $output .= drupal_render_children($form);
  drupal_add_tabledrag('alinks-table', 'order', 'siblings', $table_drag_weight_cls);
  return $output;
}