Index: trunk/extensions/SemanticForms/includes/SF_FormInputs.php |
— | — | @@ -186,6 +186,11 @@ |
187 | 187 | public static function getHTML( $cur_value, $input_name, $is_mandatory, $is_disabled, $other_args ) { |
188 | 188 | global $sfgTabIndex, $sfgFieldNum; |
189 | 189 | |
| 190 | + // For backward compatibility with pre-SF-2.1 forms |
| 191 | + if ( array_key_exists( 'autocomplete field type', $other_args ) ) { |
| 192 | + return SFTextWithAutocompleteInput::getHTML( $cur_value, $input_name, $is_mandatory, $is_disabled, $other_args ); |
| 193 | + } |
| 194 | + |
190 | 195 | $className = "createboxInput"; |
191 | 196 | if ( $is_mandatory ) { |
192 | 197 | $className .= " mandatoryField"; |
— | — | @@ -772,7 +777,10 @@ |
773 | 778 | } |
774 | 779 | |
775 | 780 | public static function getAutocompletionTypeAndSource( $field_args ) { |
776 | | - if ( array_key_exists( 'values from property', $field_args ) || |
| 781 | + if ( array_key_exists( 'autocomplete field type', $field_args ) ) { |
| 782 | + $autocompleteFieldType = $field_args['autocomplete field type']; |
| 783 | + $autocompletionSource = $field_args['autocompletion source']; |
| 784 | + } elseif ( array_key_exists( 'values from property', $field_args ) || |
777 | 785 | array_key_exists( 'semantic_property', $field_args ) ) { |
778 | 786 | if ( array_key_exists( 'values from property', $field_args ) ) { |
779 | 787 | $autocompletionSource = $field_args['values from property']; |
— | — | @@ -804,9 +812,6 @@ |
805 | 813 | global $sfgFieldNum; |
806 | 814 | $autocompleteFieldType = 'values'; |
807 | 815 | $autocompletionSource = "values-$sfgFieldNum"; |
808 | | - } elseif ( array_key_exists( 'autocomplete field type', $field_args ) ) { |
809 | | - $autocompleteFieldType = $field_args['autocomplete field type']; |
810 | | - $autocompletionSource = $field_args['autocompletion source']; |
811 | 816 | } else { |
812 | 817 | $autocompleteFieldType = null; |
813 | 818 | $autocompletionSource = null; |
— | — | @@ -846,7 +851,10 @@ |
847 | 852 | $field_args['remote autocompletion'] == true ) { |
848 | 853 | $remoteDataType = $autocompleteFieldType; |
849 | 854 | } elseif ( $autocompletionSource != '' ) { |
850 | | - if ( $autocompleteFieldType == 'values' ) { |
| 855 | + if ( array_key_exists( 'possible_values', $field_args ) && |
| 856 | + count( $field_args['possible_values'] ) > 0 ) { |
| 857 | + $autocompleteValues = $field_args['possible_values']; |
| 858 | + } elseif ( $autocompleteFieldType == 'values' ) { |
851 | 859 | $autocompleteValues = explode( ',', $field_args['values'] ); |
852 | 860 | } else { |
853 | 861 | $autocompleteValues = SFUtils::getAutocompleteValues( $autocompletionSource, $autocompleteFieldType ); |