Index: trunk/extensions/SemanticForms/includes/SF_FormInputs.php |
— | — | @@ -777,23 +777,14 @@ |
778 | 778 | } |
779 | 779 | |
780 | 780 | public static function getAutocompletionTypeAndSource( $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 ) || |
785 | | - array_key_exists( 'semantic_property', $field_args ) ) { |
786 | | - if ( array_key_exists( 'values from property', $field_args ) ) { |
787 | | - $autocompletionSource = $field_args['values from property']; |
788 | | - } else { // if ( array_key_exists( 'semantic_property', $field_args ) ) { |
789 | | - $autocompletionSource = $field_args['semantic_property']; |
790 | | - } |
| 781 | + if ( array_key_exists( 'values from property', $field_args ) ) { |
| 782 | + $autocompletionSource = $field_args['values from property']; |
791 | 783 | $propValue = SMWPropertyValue::makeUserProperty( $autocompletionSource ); |
792 | 784 | if ( $propValue->getPropertyTypeID() == '_wpg' ) { |
793 | 785 | $autocompleteFieldType = 'relation'; |
794 | 786 | } else { |
795 | 787 | $autocompleteFieldType = 'attribute'; |
796 | 788 | } |
797 | | - |
798 | 789 | } elseif ( array_key_exists( 'values from category', $field_args ) ) { |
799 | 790 | $autocompleteFieldType = 'category'; |
800 | 791 | $autocompletionSource = $field_args['values from category']; |
— | — | @@ -812,6 +803,17 @@ |
813 | 804 | global $sfgFieldNum; |
814 | 805 | $autocompleteFieldType = 'values'; |
815 | 806 | $autocompletionSource = "values-$sfgFieldNum"; |
| 807 | + } elseif ( array_key_exists( 'autocomplete field type', $field_args ) ) { |
| 808 | + $autocompleteFieldType = $field_args['autocomplete field type']; |
| 809 | + $autocompletionSource = $field_args['autocompletion source']; |
| 810 | + } elseif ( array_key_exists( 'semantic_property', $field_args ) ) { |
| 811 | + $autocompletionSource = $field_args['semantic_property']; |
| 812 | + $propValue = SMWPropertyValue::makeUserProperty( $autocompletionSource ); |
| 813 | + if ( $propValue->getPropertyTypeID() == '_wpg' ) { |
| 814 | + $autocompleteFieldType = 'relation'; |
| 815 | + } else { |
| 816 | + $autocompleteFieldType = 'attribute'; |
| 817 | + } |
816 | 818 | } else { |
817 | 819 | $autocompleteFieldType = null; |
818 | 820 | $autocompletionSource = null; |
— | — | @@ -851,6 +853,7 @@ |
852 | 854 | $field_args['remote autocompletion'] == true ) { |
853 | 855 | $remoteDataType = $autocompleteFieldType; |
854 | 856 | } elseif ( $autocompletionSource != '' ) { |
| 857 | + // @TODO - that count() check shouldn't be necessary |
855 | 858 | if ( array_key_exists( 'possible_values', $field_args ) && |
856 | 859 | count( $field_args['possible_values'] ) > 0 ) { |
857 | 860 | $autocompleteValues = $field_args['possible_values']; |