You are here

function theme_uc_extra_fields_pane_customfields in Extra Fields Checkout Pane 6.2

Lists all custom order fields

Parameters

array $form:

Return value

string

File

./uc_extra_fields_pane.admin.inc, line 322
Admin functions for adding, editing and deleting fields

Code

function theme_uc_extra_fields_pane_customfields($form) {
  $output = "";
  $header = array();
  $header[] = array(
    'data' => t('Label'),
  );
  $header[] = array(
    'data' => t('Field name'),
  );
  $header[] = array(
    'data' => t('Pane type'),
  );
  $header[] = array(
    'data' => t('Required'),
  );
  $header[] = array(
    'data' => t('List position'),
  );
  $header[] = array(
    'data' => t('Description'),
  );
  $header[] = array(
    'data' => t('Action'),
  );
  $rows = array();
  foreach (element_children($form['fields']) as $field) {
    $row = array(
      drupal_render($form['fields'][$field]['label']),
      drupal_render($form['fields'][$field]['db_name']),
      drupal_render($form['fields'][$field]['pane_type']),
      drupal_render($form['fields'][$field]['required']),
      drupal_render($form['fields'][$field]['weight']),
      drupal_render($form['fields'][$field]['description']),
      drupal_render($form['fields'][$field]['action']),
    );
    $rows[] = array(
      'data' => $row,
      'class' => 'draggable',
    );
  }
  if (count($rows) == 0) {
    $rows[] = array(
      array(
        'data' => t('No custom order fields have been added yet.'),
        'colspan' => '7',
      ),
    );
  }
  drupal_add_tabledrag('ucxf-fields-table', 'order', 'sibling', 'ucxf-fields-table-ordering');
  $output = theme('table', $header, $rows, array(
    'id' => 'ucxf-fields-table',
  )) . theme('pager', NULL, 30) . l(t('Add a custom order field'), 'admin/store/settings/extrafields/add') . '<br />' . drupal_render($form);
  return $output;
}