One Relationship Handler to Rule Them All. (Props to solotandem for the wild idea...
[project/relation.git] / views / relation.views.inc
index 72825de..2e79632 100644 (file)
@@ -50,13 +50,15 @@ 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',
     ),
   );
 
+
   $data['relation']['vid'] = array(
     'title' => t('Vid'),
     'help' => t('The relation revision ID.'),
@@ -189,7 +191,7 @@ function relation_views_data_alter(&$data) {
         '@left' => $entity_type_left,
         '@relation_type_label' => $relation_type->label,
       );
-      $data[$base_table_left]['relation_base' . $type] = array(
+      $data[$base_table_left]['relation_base_left_' . $type] = array(
         'title' => t('Relation: @relation_type_label (@left -> relation)', $t_arguments),
         'help' => t('Provides a relationship from @left to the relation table via the relation @relation_type_label', $t_arguments),
         'relationship' => array(
@@ -198,12 +200,10 @@ function relation_views_data_alter(&$data) {
           'base' => 'relation',
           'base field' => 'rid',
           'relationship field' => $relationship_field,
-          'handler' => 'views_handler_relationship',
+          'handler' => 'relation_handler_relationship',
           'relation_type' => $type,
           'entity_type_left' => $entity_type_left,
-          'entity_type_right' => 'relation',
           'directional' => $relation_type->directional,
-          'join_handler' => 'relation_handler_base_left_join',
         ),
       );
       foreach ($relation_type->$target_index as $target_bundle) {
@@ -225,10 +225,9 @@ function relation_views_data_alter(&$data) {
             'entity_type_left' => $entity_type_left,
             'entity_type_right' => $entity_type_right,
             'directional' => $relation_type->directional,
-            'join_handler' => 'relation_handler_join',
           ),
         );
-        $data[$base_table_left]['relation_right_' . $type . '_' . $entity_type_right] = array(
+        $data['relation']['relation_base_' . $type . '_' . $entity_type_right] = array(
           'title' => t('Relation: @relation_type_label (relation -> @right)', $t_arguments),
           'help' => t('Provides a relationship from the relation table to @right via the relation @relation_type_label', $t_arguments),
           'relationship' => array(
@@ -236,13 +235,11 @@ function relation_views_data_alter(&$data) {
             'label' => check_plain($relation_type->label),
             'base' => $base_table_right,
             'base field' => $entity_infos[$entity_type_right]['entity keys']['id'],
-            'relationship field' => $relationship_field,
-            'handler' => 'views_handler_relationship',
+            'relationship field' => 'rid',
+            'handler' => 'relation_handler_relationship',
             'relation_type' => $type,
-            'entity_type_left' => 'relation',
             'entity_type_right' => $entity_type_right,
             'directional' => $relation_type->directional,
-            'join_handler' => 'relation_handler_base_right_join',
           ),
         );
       }