From a5ce14d979568d4fd8bc741f669b559dd0d013a1 Mon Sep 17 00:00:00 2001
From: Daniel Wehner <daniel.wehner@erdfisch.de>
Date: Fri, 27 Jul 2012 13:56:49 -0500
Subject: [PATCH] Experiment with module handler as PSR0

---
 .../Drupal/node/Plugins/views/filter/Status.php |  6 ++++--
 modules/node.views.inc                          |  2 +-
 views.module                                    | 17 +++++++++++++++++
 3 files changed, 22 insertions(+), 3 deletions(-)
 rename modules/node/views_handler_filter_node_status.inc => lib/Drupal/node/Plugins/views/filter/Status.php (80%)

diff --git a/modules/node/views_handler_filter_node_status.inc b/lib/Drupal/node/Plugins/views/filter/Status.php
similarity index 80%
rename from modules/node/views_handler_filter_node_status.inc
rename to lib/Drupal/node/Plugins/views/filter/Status.php
index e04d0272c85a..6fc6c8b75231 100644
--- a/modules/node/views_handler_filter_node_status.inc
+++ b/lib/Drupal/node/Plugins/views/filter/Status.php
@@ -2,9 +2,11 @@
 
 /**
  * @file
- * Definition of views_handler_filter_node_status.
+ * Definition of Drupal\node\Plugins\views\filter\Status
  */
 
+namespace Drupal\node\Plugins\views\filter;
+
 use Drupal\views\Plugins\views\filter\FilterPluginBase;
 
 /**
@@ -12,7 +14,7 @@
  *
  * @ingroup views_filter_handlers
  */
-class views_handler_filter_node_status extends FilterPluginBase {
+class Status extends FilterPluginBase {
   function admin_summary() { }
   function operator_form(&$form, &$form_state) { }
   function can_expose() { return FALSE; }
diff --git a/modules/node.views.inc b/modules/node.views.inc
index befcda151e22..b04a90a3e20e 100644
--- a/modules/node.views.inc
+++ b/modules/node.views.inc
@@ -172,7 +172,7 @@ function node_views_data() {
     'help' => t('Filters out unpublished content if the current user cannot view it.'),
     'filter' => array(
       'field' => 'status',
-      'handler' => 'views_handler_filter_node_status',
+      'handler' => 'Drupal\node\Plugins\views\filter\Status',
       'label' => t('Published or admin'),
     ),
   );
diff --git a/views.module b/views.module
index 7c25d6d17d6f..ee7aa345347c 100644
--- a/views.module
+++ b/views.module
@@ -33,6 +33,23 @@ function views_api_version() {
   return '3.0';
 }
 
+/**
+ * Implements hook_init().
+ *
+ *
+ */
+function views_init() {
+  $core_modules = array('aggregator', 'book', 'comment', 'contact', 'field', 'filter', 'locale', 'node', 'search', 'statistics', 'system', 'taxonomy', 'translation', 'user');
+  $path = drupal_get_path('module', 'views');
+  $loader = drupal_classloader();
+  foreach ($core_modules as $module) {
+    if (function_exists($module . '_views_api')) {
+      $name = $module . '\\Plugins';
+      $loader->registerNamespace('Drupal\\' . $name, DRUPAL_ROOT . '/' . $path . '/lib');
+    }
+  }
+}
+
 /**
  * Implements hook_ctools_exportable_info().
  */
-- 
GitLab