You are here

function _webform_display_select in Webform 7.4

Same name and namespace in other branches
  1. 6.3 components/select.inc \_webform_display_select()
  2. 7.3 components/select.inc \_webform_display_select()

Implements _webform_display_component().

1 call to _webform_display_select()
webform_tokens in ./webform.tokens.inc
Implements hook_tokens().

File

components/select.inc, line 505
Webform module multiple select component.

Code

function _webform_display_select($component, $value, $format = 'html', $submission = array()) {

  // Sort values by numeric key. These may be in alphabetic order from the database query,
  // which is not numeric order for keys '10' and higher.
  $value = (array) $value;
  ksort($value, SORT_NUMERIC);
  return array(
    '#title' => $component['name'],
    '#title_display' => $component['extra']['title_display'] ? $component['extra']['title_display'] : 'before',
    '#weight' => $component['weight'],
    '#multiple' => $component['extra']['multiple'],
    '#theme' => 'webform_display_select',
    '#theme_wrappers' => $format == 'html' ? array(
      'webform_element',
    ) : array(
      'webform_element_text',
    ),
    '#format' => $format,
    '#options' => _webform_select_options($component, !$component['extra']['aslist']),
    '#value' => $value,
    '#translatable' => array(
      'title',
      'options',
    ),
  );
}