You are here

function theme_freelinking_page_form in Freelinking 6

Same name and namespace in other branches
  1. 5 freelinking.module \theme_freelinking_page_form()
  2. 6.2 freelinking.module \theme_freelinking_page_form()

File

./freelinking.module, line 132

Code

function theme_freelinking_page_form($form) {
  if (isset($form['options']) && is_array($form['options'])) {
    $output .= drupal_render($form['options']);
    $header = array(
      theme('table_select_header_cell'),
      array(
        'data' => t('Phrase'),
        'field' => 'phrase',
        'sort' => 'asc',
      ),
      array(
        'data' => t('Target'),
        'field' => 'path',
      ),
    );
  }
  if (isset($form['phrase']) && is_array($form['phrase'])) {
    foreach (element_children($form['phrase']) as $key) {
      $row = array();
      if (isset($form['links'][$key])) {
        $row[] = drupal_render($form['links'][$key]);
      }
      $row[] = drupal_render($form['phrase'][$key]);
      $row[] = drupal_render($form['target'][$key]);
      $rows[] = $row;
    }
  }
  else {
    $rows[] = array(
      array(
        'data' => t('No freelinks available.'),
        'colspan' => user_access('administer freelinking') ? '3' : '2',
      ),
    );
  }

  // endif else no freelinks
  $output .= theme('table', $header, $rows);
  if ($form['pager']['#value']) {
    $output .= drupal_render($form['pager']);
  }
  $output .= drupal_render($form);
  return $output;
}