You are here

function theme_entityreference_prepopulate_providers_table in Entityreference prepopulate 7

Theme the providers table.

1 theme call to theme_entityreference_prepopulate_providers_table()
EntityReferencePrepopulateInstanceBehavior::settingsForm in plugins/behavior/EntityReferencePrepopulateInstanceBehavior.class.php
Generate a settings form for this handler.

File

plugins/behavior/EntityReferencePrepopulateInstanceBehavior.class.php, line 137

Code

function theme_entityreference_prepopulate_providers_table($variables) {
  $form = $variables['form'];
  $provider_names = element_children($form['enabled']);
  foreach ($provider_names as $provider_name) {
    $row = array(
      'data' => array(
        drupal_render($form['title'][$provider_name]),
        drupal_render($form['enabled'][$provider_name]),
        drupal_render($form['weight'][$provider_name]),
      ),
      'class' => array(
        'draggable',
      ),
    );
    $rows[] = $row;
  }
  $header = array(
    array(
      'data' => t('Provider'),
    ),
    array(
      'data' => t('Enabled'),
    ),
    array(
      'data' => t('Weight'),
    ),
  );
  $table_variables = array(
    'header' => $header,
    'rows' => $rows,
    'attributes' => array(
      'id' => 'table-providers',
    ),
  );
  $output = theme('table', $table_variables);
  drupal_add_tabledrag('table-providers', 'order', 'sibling', 'provider-weight');
  return $output;
}