You are here

function theme_ddblock_mappings_table in Dynamic display block 7

File

./ddblock.module, line 2727
Enables your site to display dynamic content in a block.

Code

function theme_ddblock_mappings_table($form) {
  $vars['header'] = array(
    t('Target'),
    t('Source'),
  );
  $vars['rows'] = array();
  foreach (element_children($form) as $key) {

    // No need to print the field title every time.
    unset($form[$key]['target']['#title'], $form[$key]['source']['#title']);

    // Build the table row.
    $row = array(
      'data' => array(
        array(
          'data' => drupal_render($form[$key]['target']) . drupal_render($form[$key]['target']),
          'class' => 'target',
        ),
        array(
          'data' => drupal_render($form[$key]['source']) . drupal_render($form[$key]['source']),
          'class' => 'source',
        ),
      ),
    );

    // Add additional attributes to the row, such as a class for this row.
    if (isset($form[$key]['#attributes'])) {
      $row = array_merge($row, $form[$key]['#attributes']);
    }
    $vars['rows'][] = $row;
  }
  $output = theme('table', $vars);
  $output .= drupal_render($form);
  return $output;
}