summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaroly Negyesi2011-12-08 21:54:43 +0000
committerKaroly Negyesi2011-12-08 21:54:43 +0000
commitb5d7a3d58c71088bd5a613ed4b7e9972ec91f8e9 (patch)
treed21ec641e70f1ddb001a8b7e2cf599b1accfbd51
parenta9b89e8759a3eccf2869aa14bbc7a46c59546885 (diff)
Views integration: setup relation: type as filter_in_operator instead of string #1365406 by dereine.
-rw-r--r--relation.module14
-rw-r--r--views/relation.views.inc3
2 files changed, 16 insertions, 1 deletions
diff --git a/relation.module b/relation.module
index 8e0168f..0073af3 100644
--- a/relation.module
+++ b/relation.module
@@ -455,6 +455,20 @@ function relation_get_types($types = array()) {
}
/**
+ * Returns all relation types in a way which can be used
+ * on form options.
+ */
+function relation_get_types_options() {
+ $types = relation_get_types();
+ $options = array();
+ foreach ($types as $type => $relation_type) {
+ $options[$type] = $relation_type->label;
+ }
+
+ return $options;
+}
+
+/**
* Helper function. Attaches bundles to relation type objects in an array.
*/
function _relation_get_types_bundles(&$relation_types) {
diff --git a/views/relation.views.inc b/views/relation.views.inc
index eb4b040..7d0ce65 100644
--- a/views/relation.views.inc
+++ b/views/relation.views.inc
@@ -50,7 +50,8 @@ function relation_views_data() {
'numeric' => TRUE,
),
'filter' => array(
- 'handler' => 'views_handler_filter_string',
+ 'handler' => 'views_handler_filter_in_operator',
+ 'options callback' => 'relation_get_types_options',
),
'sort' => array(
'handler' => 'views_handler_sort',