Index: trunk/extensions/SemanticDrilldown/includes/SD_Filter.php |
— | — | @@ -30,22 +30,30 @@ |
31 | 31 | $sd_array = $object_values['sd']; |
32 | 32 | $smw_array = $fieldObj->getObject('semanticmediawiki_Property'); //this returns an array with property values filled |
33 | 33 | $prop_array = $smw_array['smw']; |
34 | | - $f->name = $sd_array['Label']; |
| 34 | + if ( array_key_exists( 'Label', $sd_array ) ) { |
| 35 | + $f->name = $sd_array['Label']; |
| 36 | + } else { |
| 37 | + $f->name = $prop_array['name']; |
| 38 | + } |
35 | 39 | $f->property = $prop_array['name']; |
36 | 40 | $f->escaped_property = str_replace( array( ' ', "'" ), array( '_', "\'" ), $f->property ); |
37 | 41 | $f->is_relation = true; |
| 42 | + if ( array_key_exists( 'Type', $prop_array ) && $prop_array['Type'] != 'Page' ) { |
| 43 | + $f->is_relation = false; |
| 44 | + } |
38 | 45 | $f->input_type = $sd_array['InputType']; |
39 | | - if ( $sd_array['ValuesFromCategory'] != null ) { |
| 46 | + if ( array_key_exists( 'ValuesFromCategory', $sd_array ) ) { |
40 | 47 | $f->category = $sd_array['ValuesFromCategory']; |
41 | 48 | $f->allowed_values = SDUtils::getCategoryChildren( $f->category, false, 5 ); |
42 | | - } elseif ( $sd_array['TimePeriod'] != null ) { |
| 49 | + } elseif ( array_key_exists( 'TimePeriod', $sd_array ) ) { |
43 | 50 | $f->time_period = $sd_array['TimePeriod']; |
44 | 51 | $f->allowed_values = array(); |
45 | 52 | } elseif ( $f->is_boolean ) { |
46 | 53 | $f->allowed_values = array( '0', '1' ); |
| 54 | + } elseif ( array_key_exists( 'Values', $sd_array ) ) { |
| 55 | + $f->allowed_values = $sd_array['Values']; |
47 | 56 | } else { |
48 | | - $values = $sd_array['Values']; |
49 | | - $f->allowed_values = $values; |
| 57 | + $f->allowed_values = array(); |
50 | 58 | } |
51 | 59 | $filters_ps[] = $f ; |
52 | 60 | } |