You are here

function theme_webform_component_select in Webform 6.3

Same name and namespace in other branches
  1. 7.4 includes/webform.components.inc \theme_webform_component_select()
  2. 7.3 includes/webform.components.inc \theme_webform_component_select()

Theme the contents of a Webform component select element.

File

includes/webform.components.inc, line 961
Webform module component handling.

Code

function theme_webform_component_select($element) {
  drupal_add_js('misc/tableselect.js');
  drupal_add_js(drupal_get_path('module', 'webform') . '/js/webform-admin.js', 'module', 'header', FALSE, TRUE, FALSE);
  $rows = array();
  $header = array();
  if (!isset($element['#all_checkbox']) || $element['#all_checkbox']) {
    $header = array(
      array(
        'class' => 'select-all',
        'data' => ' ' . t('Include all components'),
      ),
    );
  }
  foreach (element_children($element) as $key) {
    $rows[] = array(
      theme('indentation', $element[$key]['#indent']) . drupal_render($element[$key]),
    );
  }
  $element['#collapsible'] = isset($element['#collapsible']) ? $element['#collapsible'] : TRUE;
  $element['#collapsed'] = isset($element['#collapsed']) ? $element['#collapsed'] : TRUE;
  $element['#attributes']['class'] = 'webform-component-select-table';
  if (empty($rows)) {
    $element['#children'] = t('No available components.');
  }
  else {
    $element['#children'] = '<div class="webform-component-select-wrapper">' . theme('table', $header, $rows) . '</div>';
  }
  $element['#value'] = NULL;
  return theme('fieldset', $element);
}