You are here

function theme_salesforce_api_fieldmap_edit_form_table in Salesforce Suite 7.2

Same name and namespace in other branches
  1. 5.2 salesforce_api/salesforce_api.admin.inc \theme_salesforce_api_fieldmap_edit_form_table()
  2. 6.2 salesforce_api/salesforce_api.admin.inc \theme_salesforce_api_fieldmap_edit_form_table()
  3. 7 salesforce_api/salesforce_api.admin.inc \theme_salesforce_api_fieldmap_edit_form_table()

Themes the field associations on a fieldmap edit form into a table.

1 theme call to theme_salesforce_api_fieldmap_edit_form_table()
salesforce_api_fieldmap_edit_form in salesforce_api/salesforce_api.admin.inc

File

salesforce_api/salesforce_api.admin.inc, line 1039
Contains the admin page callbacks for the Salesforce module, including forms for general settings and fieldmap administration.

Code

function theme_salesforce_api_fieldmap_edit_form_table($variables) {
  $form = $variables['form'];

  // Build the header array.
  $header = array();
  foreach (element_children($form['header']) as $element) {
    $header[] = drupal_render($form['header'][$element]);
  }

  // Add the operations column. (Currently "Remove" is the only operation.
  $header[] = 'Operations';

  // Build the rows array.
  $rows = array();
  foreach (element_children($form['rows']) as $element) {
    $rows[] = array(
      array(
        'data' => drupal_render($form['rows'][$element]['target']),
        'class' => 'target-cell',
      ),
      array(
        'data' => drupal_render($form['rows'][$element]['source']),
        'class' => 'source-cell',
      ),
      array(
        'data' => drupal_render($form['rows'][$element]['remove']),
      ),
    );
  }

  // Add a message if no rows were found.
  if (empty($rows)) {
    $rows[] = array(
      array(
        'data' => t('No fields set.'),
        'colspan' => 3,
      ),
    );
  }

  // Build the attributes array.
  $attributes = array();

  // Build the caption.
  $caption = NULL;
  if (isset($form['caption'])) {
    $caption = drupal_render_children($form['caption']);
  }
  return theme('table', array(
    'header' => $header,
    'rows' => $rows,
    'attributes' => $attributes,
    'caption' => $caption,
  ));
}