From 4dde0414657b0c10555767a1f402b949c82fee67 Mon Sep 17 00:00:00 2001
From: Jerenus Zheng <Jerenus@1864306.no-reply.drupal.org>
Date: Mon, 27 Aug 2012 15:36:21 +0800
Subject: [PATCH] Issue #1380726 by Jerenus: Location field Additional filter
 needed for Views in D7.

---
 .../location_handler_field_location_additional.inc |   21 +++++++++++++++++
 location.views.inc                                 |   24 ++++++++++++++++++++
 2 files changed, 45 insertions(+)
 create mode 100644 handlers/location_handler_field_location_additional.inc

diff --git a/handlers/location_handler_field_location_additional.inc b/handlers/location_handler_field_location_additional.inc
new file mode 100644
index 0000000..0fddabe
--- /dev/null
+++ b/handlers/location_handler_field_location_additional.inc
@@ -0,0 +1,21 @@
+ 
+<?php
+
+/**
+ * @file
+ * Addition field handler.
+ */
+
+class location_handler_field_location_additional extends views_handler_field {
+
+  function option_definition() {
+    $options = parent::option_definition();
+    $options['style'] = array('default' => 'name');
+    return $options;
+  }
+
+  function render($values) {
+    return check_plain(trim($values->{$this->aliases['additional']}));
+  }
+}
+                
diff --git a/location.views.inc b/location.views.inc
index 58c5ff7..37ea21c 100644
--- a/location.views.inc
+++ b/location.views.inc
@@ -59,6 +59,9 @@ function location_views_handlers() {
       'location_handler_field_location_street' => array(
         'parent' => 'views_handler_field',
       ),
+      'location_handler_field_location_additional' => array(
+	'parent' => 'views_handler_field',
+      ),
       'location_views_handler_filter_proximity' => array(
         'parent' => 'views_handler_filter',
       ),
@@ -183,6 +186,27 @@ function location_views_data() {
     ),
   );
 
+   $data['location']['additional'] = array(
+    'title' => t('Additional'),
+    'help' => t('Additional street address of the selected location.'),
+    'field' => array(
+      'click sortable' => TRUE,
+    ),
+    'argument' => array(
+      'handler' => 'views_handler_argument_string',
+      // 'empty field name' => t('Unknown'),
+    ),
+    'filter' => array(
+      'handler' => 'views_handler_filter_string',
+    ),
+    'sort' => array(
+      'handler' => 'views_handler_sort',
+    ),
+  );
+
+
+
+
   $data['location']['city'] = array(
     'title' => t('City'),
     'help' => t('The city of the selected location.'),
-- 
1.7.9.5

