function _arrayCompare(&$boundValue, &$candidateValue, &$bindStatus) { if (in_array($candidateValue, $boundValue)) { return true; } else { foreach ($boundValue as $val) { if (SelectedValueComparator::_exhaustiveCompare($val, $candidateValue, $bindStatus->getEditor())) { return true; } } } return false; }
function option($value, $label = null, $options = array()) { global $request; $bindStatus =& $request->getAttribute('select_listValue'); assert_not_null($bindStatus, 'option tag must be used within a select tag'); $iVal = _get_display_string($value, $bindStatus->getEditor()); $iLabel = $label == null ? $iVal : $label; $options['value'] = $iVal; if (SelectedValueComparator::isSelected($bindStatus, $iVal)) { $selectedVal = _tag_get_attribute('select', 'selectedVal'); if ($selectedVal !== true) { $options['selected'] = 'selected'; _tag_set_attribute('select', 'selectedVal', $val = true); } } return content_tag('option', $iLabel, $options); }