You are here

function _linkit_theme_profile_form_table in Linkit 7.2

Helper function to render settings tables.

Parameters

$variables.:

$type: "plugin" or "attribute".

1 call to _linkit_theme_profile_form_table()
theme_linkit_profiles_export_ui_form in ./linkit.theme.inc
Returns HTML for the profile form.

File

./linkit.theme.inc, line 104
Linkit theme functions.

Code

function _linkit_theme_profile_form_table($variables, $type) {
  $rows = array();
  $has_description = FALSE;

  // Build table rows.
  foreach ($variables['linkit_' . $type . '_listing'] as $delta => $element) {
    $fields = array(
      $element->title,
      $element->weight_select,
      $element->enabled,
    );
    if (isset($element->description)) {
      $has_description = TRUE;
      $fields[] = $element->description;
    }
    $rows[$delta]['data'] = $fields;
    $rows[$delta]['class'] = array(
      'draggable',
      'tabledrag-leaf',
    );
  }
  drupal_add_tabledrag('linkit-' . $type, 'order', 'sibling', 'weight');
  $header = array(
    t('Name'),
    t('Weight'),
    t('Enabled'),
  );
  if ($has_description) {
    $header[] = t('Description');
  }
  return theme('table', array(
    'header' => $header,
    'rows' => $rows,
    'attributes' => array(
      'id' => 'linkit-' . $type,
    ),
    'sticky' => FALSE,
  ));
}