You are here

function theme_salesforce_mapping_form_table_row in Salesforce Suite 7.3

Theme a single row for our ajax callback to inject into an existing table.

See also

salesforce_mapping_form_field_callback()

theme_table()

1 theme call to theme_salesforce_mapping_form_table_row()
salesforce_mapping_form_field_callback in modules/salesforce_mapping/includes/salesforce_mapping.admin.inc
Ajax callback for deleting a field mapping row.

File

modules/salesforce_mapping/includes/salesforce_mapping.admin.inc, line 474
Configuration page for creating and modifying a mapping.

Code

function theme_salesforce_mapping_form_table_row($variables) {
  watchdog('row', "<pre>" . var_export($variables, 1));
  $elements = $variables['elements'];

  // Build the rows array.
  $columns = !empty($elements['#columns']) ? $elements['#columns'] : array();
  $row = !empty($elements['#row']) ? $elements['#row'] : array();
  $attributes = !empty($row['#attributes']) ? $row['#attributes'] : array();
  $output = '<tr' . drupal_attributes($attributes) . '>';
  $data = array();
  foreach ($columns as $column) {
    if (isset($row[$column])) {
      $cell = array(
        'data' => drupal_render($row[$column]),
      );
      if (isset($row[$column]['#attributes'])) {
        foreach ($row[$column]['#attributes'] as $key => $value) {
          $cell[$key] = $key == 'id' ? is_array($value) ? array(
            $value[0] . '-cell',
          ) : $value . '-cell' : $value;
        }
      }
      $output .= _theme_table_cell($cell);
    }
  }
  $output .= "</tr>";
  return $output;
}