You are here

function _uc_dropdown_attributes_construct_table in Dropdown Attributes 7

Construction of table for administration of attribute dependencies.

Common theming code for the table in the administrative interface for the node or product class.

Parameters

array $form: The form array.

Return value

string Rendered html for the table.

2 calls to _uc_dropdown_attributes_construct_table()
theme_uc_dropdown_attributes_class in ./dependent_dropdown.inc
Form theme handler for uc_dropdown_attributes_class().
theme_uc_dropdown_attributes_product in ./dependent_dropdown.inc
Form theme handler for uc_dropdown_attributes_product().

File

./dependent_dropdown.inc, line 294
Administrative interface for specifying the attribute dependencies.

Code

function _uc_dropdown_attributes_construct_table($form) {
  $output = '';
  $output .= drupal_render($form['intro']);
  $headers = array(
    t('Header'),
    t('Depends on'),
    t('With values'),
    t('Required'),
  );
  $rows = array();
  if (isset($form['attributes'])) {
    foreach (element_children($form['attributes']) as $aid) {
      if (is_numeric($aid)) {
        $row = array();
        $row[] = drupal_render($form['attributes'][$aid]['attribute']);
        $row[] = drupal_render($form['attributes'][$aid]['parent']);
        $row[] = drupal_render($form['attributes'][$aid]['values']);
        $row[] = drupal_render($form['attributes'][$aid]['required']);
        $rows[] = $row;
      }
    }
  }
  $output .= theme('table', array(
    'header' => $headers,
    'rows' => $rows,
  ));
  $output .= drupal_render_children($form);
  return $output;
}