You are here

function webform_conditional_form_select in Webform 7.4

Form callback for select-type conditional fields.

Unlike other built-in conditional value forms, the form callback for select types provides an array of forms, keyed by the $cid, which is the "source" for the condition.

1 string reference to 'webform_conditional_form_select'
_webform_conditional_operator_info in includes/webform.conditionals.inc
Implements hook_webform_conditional_operator_info().

File

includes/webform.conditionals.inc, line 1283
Form elements and menu callbacks to provide conditional handling in Webform.

Code

function webform_conditional_form_select($node) {
  static $count = 0;
  $forms = array();
  webform_component_include('select');
  foreach ($node->webform['components'] as $cid => $component) {
    if (webform_component_property($component['type'], 'conditional_type') == 'select') {

      // @todo Use a pluggable mechanism for retrieving select list values.
      $options = _webform_select_options($component);
      $element = array(
        '#type' => 'select',
        '#multiple' => FALSE,
        '#size' => NULL,
        '#attributes' => array(),
        '#id' => NULL,
        '#name' => 'webform-conditional-select-' . $cid . '-' . $count,
        '#options' => $options,
        '#parents' => array(),
      );
      $forms[$cid] = drupal_render($element);
    }
  }
  $count++;
  return $forms;
}