You are here

function _webform_display_shs in Webform Simple Hierarchical Select 7

Implements _webform_display_component().

File

components/shs.inc, line 135
Webform simple hierarchical select component.

Code

function _webform_display_shs($component, $value, $format = 'html') {
  $display = array(
    '#title' => $component['name'],
    '#weight' => $component['weight'],
    '#theme' => $format == 'html' ? 'webform_display_markup' : 'webform_display_textfield',
    '#theme_wrappers' => $format == 'html' ? array(
      'webform_element',
    ) : array(
      'webform_element_text',
    ),
    '#post_render' => array(
      'webform_element_wrapper',
    ),
    '#component' => $component,
    '#format' => $format,
    '#value' => '',
    '#field_prefix' => '',
    '#field_suffix' => '',
  );
  $newline = $format == 'html' ? '<br/>' : "\n";
  foreach (_webform_shs_get_labels_for_output($value) as $label) {
    $display['#value'] .= check_plain($label) . $newline;
  }
  return $display;
}