You are here

function _webform_conditional_andor_expand in Webform 7.4

Helper. Generate the and/or select or static text.

2 calls to _webform_conditional_andor_expand()
_webform_conditional_expand in includes/webform.conditionals.inc
Form API #process function to expand a webform conditional element.
_webform_conditional_rule_expand in includes/webform.conditionals.inc
Helper. Generate form elements for one rule.

File

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

Code

function _webform_conditional_andor_expand(&$andor) {
  if ($andor['first']) {
    $andor['first'] = FALSE;
    return array(
      '#type' => 'select',
      '#title' => t('And/or'),
      '#options' => array(
        'and' => t('and'),
        'or' => t('or'),
      ),
      '#parents' => $andor['parents'],
      '#default_value' => $andor['value'],
      '#attributes' => array(
        'data-rid' => $andor['rid'],
      ),
    );
  }
  else {
    return array(
      '#type' => 'container',
      '#attributes' => array(
        'class' => array(
          'webform-andor',
        ),
        'data-rid' => $andor['rid'],
      ),
      'andor_text' => array(
        '#markup' => $andor['value'] == 'or' ? t('or') : t('and'),
      ),
    );
  }
}