From 5019a1903231222e413cd59c02f24f1614f3f245 Mon Sep 17 00:00:00 2001
From: Daniel Wehner <daniel.wehner@erdfisch.de>
Date: Sun, 29 Jul 2012 15:03:09 -0500
Subject: [PATCH] convert system stuff

---
 .../Plugin/views/argument/Fid.php}            | 13 +++++++++++-
 .../Plugin/views/field/Extension.php}         | 14 ++++++++++++-
 .../Plugin/views/field/File.php}              | 14 ++++++++++++-
 .../Plugin/views/field/FileMime.php}          | 12 ++++++++++-
 .../Plugin/views/field/Status.php}            | 13 +++++++++++-
 .../Plugin/views/field/Uri.php}               | 10 +++++++++-
 .../Plugin/views/filter/Status.php}           | 13 +++++++++++-
 ...andler_filter_system_type.inc => Type.php} | 11 +++++++++-
 modules/system.views.inc                      | 20 +++++++++----------
 9 files changed, 102 insertions(+), 18 deletions(-)
 rename lib/Views/{system/Plugin/views/argument/views_handler_argument_file_fid.inc => file/Plugin/views/argument/Fid.php} (71%)
 rename lib/Views/{system/Plugin/views/field/views_handler_field_file_extension.inc => file/Plugin/views/field/Extension.php} (61%)
 rename lib/Views/{system/Plugin/views/field/views_handler_field_file.inc => file/Plugin/views/field/File.php} (87%)
 rename lib/Views/{system/Plugin/views/field/views_handler_field_file_filemime.inc => file/Plugin/views/field/FileMime.php} (86%)
 rename lib/Views/{system/Plugin/views/field/views_handler_field_file_status.inc => file/Plugin/views/field/Status.php} (56%)
 rename lib/Views/{system/Plugin/views/field/views_handler_field_file_uri.inc => file/Plugin/views/field/Uri.php} (87%)
 rename lib/Views/{system/Plugin/views/filter/views_handler_filter_file_status.inc => file/Plugin/views/filter/Status.php} (56%)
 rename lib/Views/system/Plugin/views/filter/{views_handler_filter_system_type.inc => Type.php} (66%)

diff --git a/lib/Views/system/Plugin/views/argument/views_handler_argument_file_fid.inc b/lib/Views/file/Plugin/views/argument/Fid.php
similarity index 71%
rename from lib/Views/system/Plugin/views/argument/views_handler_argument_file_fid.inc
rename to lib/Views/file/Plugin/views/argument/Fid.php
index aa2d94719353..3adf451a926f 100644
--- a/lib/Views/system/Plugin/views/argument/views_handler_argument_file_fid.inc
+++ b/lib/Views/file/Plugin/views/argument/Fid.php
@@ -5,12 +5,23 @@
  * Definition of views_handler_argument_file_fid.
  */
 
+namespace Views\file\Plugin\views\argument;
+
+use Drupal\Core\Annotation\Plugin;
+use Drupal\views\Plugin\views\argument\Numeric;
+
 /**
  * Argument handler to accept multiple file ids.
  *
  * @ingroup views_argument_handlers
  */
-class views_handler_argument_file_fid extends views_handler_argument_numeric {
+
+/**
+ * @Plugin(
+ *   plugin_id = "file_fid"
+ * )
+ */
+class Fid extends Numeric {
   /**
    * Override the behavior of title_query(). Get the filenames.
    */
diff --git a/lib/Views/system/Plugin/views/field/views_handler_field_file_extension.inc b/lib/Views/file/Plugin/views/field/Extension.php
similarity index 61%
rename from lib/Views/system/Plugin/views/field/views_handler_field_file_extension.inc
rename to lib/Views/file/Plugin/views/field/Extension.php
index 6f9a03fe32fd..88849876d612 100644
--- a/lib/Views/system/Plugin/views/field/views_handler_field_file_extension.inc
+++ b/lib/Views/file/Plugin/views/field/Extension.php
@@ -5,11 +5,23 @@
  * Definition of views_handler_field_file_extension.
  */
 
+namespace Views\file\Plugin\views\field;
+
+use Drupal\Core\Annotation\Plugin;
+use Drupal\views\Plugin\views\field\FieldPluginBase;
+
 /**
  * Returns a pure file extension of the file, for example 'module'.
+ *
  * @ingroup views_field_handlers
  */
-class views_handler_field_file_extension extends views_handler_field {
+
+/**
+ * @Plugin(
+ *   plugin_id = "file_extension"
+ * )
+ */
+class Extension extends FieldPluginBase {
   function render($values) {
     $value = $this->get_value($values);
     if (preg_match('/\.([^\.]+)$/', $value, $match)) {
diff --git a/lib/Views/system/Plugin/views/field/views_handler_field_file.inc b/lib/Views/file/Plugin/views/field/File.php
similarity index 87%
rename from lib/Views/system/Plugin/views/field/views_handler_field_file.inc
rename to lib/Views/file/Plugin/views/field/File.php
index 4168acf759f1..b61b78dd5833 100644
--- a/lib/Views/system/Plugin/views/field/views_handler_field_file.inc
+++ b/lib/Views/file/Plugin/views/field/File.php
@@ -5,12 +5,24 @@
  * Definition of views_handler_field_file.
  */
 
+namespace Views\file\Plugin\views\field;
+
+use Drupal\Core\Annotation\Plugin;
+use Drupal\views\Plugin\views\field\FieldPluginBase;
+
+
 /**
  * Field handler to provide simple renderer that allows linking to a file.
  *
  * @ingroup views_field_handlers
  */
-class views_handler_field_file extends views_handler_field {
+
+/**
+ * @Plugin(
+ *   plugin_id = "file"
+ * )
+ */
+class File extends FieldPluginBase {
   /**
    * Constructor to provide additional field to add.
    */
diff --git a/lib/Views/system/Plugin/views/field/views_handler_field_file_filemime.inc b/lib/Views/file/Plugin/views/field/FileMime.php
similarity index 86%
rename from lib/Views/system/Plugin/views/field/views_handler_field_file_filemime.inc
rename to lib/Views/file/Plugin/views/field/FileMime.php
index 318fdcff3222..3dd61a8296cd 100644
--- a/lib/Views/system/Plugin/views/field/views_handler_field_file_filemime.inc
+++ b/lib/Views/file/Plugin/views/field/FileMime.php
@@ -5,12 +5,22 @@
  * Definition of views_handler_field_file_filemime.
  */
 
+namespace Views\file\Plugin\views\field;
+
+use Drupal\Core\Annotation\Plugin;
+
 /**
  * Field handler to add rendering MIME type images as an option on the filemime field.
  *
  * @ingroup views_field_handlers
  */
-class views_handler_field_file_filemime extends views_handler_field_file {
+
+/**
+ * @Plugin(
+ *   plugin_id = "file_filemime"
+ * )
+ */
+class FileMime extends File {
   function option_definition() {
     $options = parent::option_definition();
     $options['filemime_image'] = array('default' => FALSE, 'bool' => TRUE);
diff --git a/lib/Views/system/Plugin/views/field/views_handler_field_file_status.inc b/lib/Views/file/Plugin/views/field/Status.php
similarity index 56%
rename from lib/Views/system/Plugin/views/field/views_handler_field_file_status.inc
rename to lib/Views/file/Plugin/views/field/Status.php
index ac1022c8d905..3ff9ba0d3751 100644
--- a/lib/Views/system/Plugin/views/field/views_handler_field_file_status.inc
+++ b/lib/Views/file/Plugin/views/field/Status.php
@@ -5,12 +5,23 @@
  * Definition of views_handler_field_file_status.
  */
 
+namespace Views\file\Plugin\views\field;
+
+use Drupal\Core\Annotation\Plugin;
+use Drupal\views\Plugin\views\field\FieldPluginBase;
+
 /**
  * Field handler to translate a node type into its readable form.
  *
  * @ingroup views_field_handlers
  */
-class views_handler_field_file_status extends views_handler_field {
+
+/**
+ * @Plugin(
+ *   plugin_id = "file_status"
+ * )
+ */
+class Status extends FieldPluginBase {
   function render($values) {
     $value = $this->get_value($values);
     return _views_file_status($value);
diff --git a/lib/Views/system/Plugin/views/field/views_handler_field_file_uri.inc b/lib/Views/file/Plugin/views/field/Uri.php
similarity index 87%
rename from lib/Views/system/Plugin/views/field/views_handler_field_file_uri.inc
rename to lib/Views/file/Plugin/views/field/Uri.php
index 334e5051aac6..4e8c16b21500 100644
--- a/lib/Views/system/Plugin/views/field/views_handler_field_file_uri.inc
+++ b/lib/Views/file/Plugin/views/field/Uri.php
@@ -5,10 +5,18 @@
  * Definition of views_handler_field_file_uri.
  */
 
+namespace Views\file\Plugin\views\field;
+
+use Drupal\Core\Annotation\Plugin;
+
 /**
  * Field handler to add rendering file paths as file URLs instead of as internal file URIs.
+ *
+ * @Plugin(
+ *   plugin_id = "file_uri"
+ * )
  */
-class views_handler_field_file_uri extends views_handler_field_file {
+class Uri extends File {
   function option_definition() {
     $options = parent::option_definition();
     $options['file_download_path'] = array('default' => FALSE, 'bool' => TRUE);
diff --git a/lib/Views/system/Plugin/views/filter/views_handler_filter_file_status.inc b/lib/Views/file/Plugin/views/filter/Status.php
similarity index 56%
rename from lib/Views/system/Plugin/views/filter/views_handler_filter_file_status.inc
rename to lib/Views/file/Plugin/views/filter/Status.php
index 6194395bfac1..425b7fb2b6c2 100644
--- a/lib/Views/system/Plugin/views/filter/views_handler_filter_file_status.inc
+++ b/lib/Views/file/Plugin/views/filter/Status.php
@@ -5,12 +5,23 @@
  * Definition of views_handler_filter_file_status.
  */
 
+namespace Views\file\Plugin\views\filter;
+
+use Drupal\Core\Annotation\Plugin;
+use Drupal\views\Plugin\views\filter\InOperator;
+
 /**
  * Filter by file status.
  *
  * @ingroup views_filter_handlers
  */
-class views_handler_filter_file_status extends views_handler_filter_in_operator {
+
+/**
+ * @Plugin(
+ *   plugin_id = "file_status"
+ * )
+ */
+class Status extends InOperator {
   function get_value_options() {
     if (!isset($this->value_options)) {
       $this->value_options = _views_file_status();
diff --git a/lib/Views/system/Plugin/views/filter/views_handler_filter_system_type.inc b/lib/Views/system/Plugin/views/filter/Type.php
similarity index 66%
rename from lib/Views/system/Plugin/views/filter/views_handler_filter_system_type.inc
rename to lib/Views/system/Plugin/views/filter/Type.php
index 84d4bcd86ce9..f2b2e75b3b13 100644
--- a/lib/Views/system/Plugin/views/filter/views_handler_filter_system_type.inc
+++ b/lib/Views/system/Plugin/views/filter/Type.php
@@ -5,10 +5,19 @@
  * Definition of views_handler_filter_system_type.
  */
 
+namespace Views\system\Plugin\views\filter;
+
+use Drupal\views\Plugin\views\filter\InOperator;
+use Drupal\Core\Annotation\Plugin;
+
 /**
  * Filter by system type.
+ *
+ * @Plugin(
+ *   plugin_id = "system_type"
+ * )
  */
-class views_handler_filter_system_type extends views_handler_filter_in_operator {
+class Type extends InOperator {
   function get_value_options() {
     if (!isset($this->value_options)) {
       $this->value_title = t('Type');
diff --git a/modules/system.views.inc b/modules/system.views.inc
index 11d621500b94..fffd0857afa7 100644
--- a/modules/system.views.inc
+++ b/modules/system.views.inc
@@ -35,11 +35,11 @@ function system_views_data() {
     'title' => t('File ID'),
     'help' => t('The ID of the file.'),
     'field' => array(
-      'handler' => 'views_handler_field_file',
+      'plugin_id' => 'file',
       'click sortable' => TRUE,
     ),
     'argument' => array(
-      'handler' => 'views_handler_argument_file_fid',
+      'plugin_id' => 'file_fid',
       'name field' => 'filename', // the field to display in the summary.
       'numeric' => TRUE,
     ),
@@ -56,7 +56,7 @@ function system_views_data() {
     'title' => t('Name'),
     'help' => t('The name of the file.'),
     'field' => array(
-      'handler' => 'views_handler_field_file',
+      'plugin_id' => 'file',
       'click sortable' => TRUE,
      ),
     'sort' => array(
@@ -75,7 +75,7 @@ function system_views_data() {
     'title' => t('Path'),
     'help' => t('The path of the file.'),
     'field' => array(
-      'handler' => 'views_handler_field_file_uri',
+      'plugin_id' => 'file_uri',
       'click sortable' => TRUE,
      ),
     'sort' => array(
@@ -94,7 +94,7 @@ function system_views_data() {
     'title' => t('Mime type'),
     'help' => t('The mime type of the file.'),
     'field' => array(
-      'handler' => 'views_handler_field_file_filemime',
+      'plugin_id' => 'file_filemime',
       'click sortable' => TRUE,
      ),
     'sort' => array(
@@ -114,7 +114,7 @@ function system_views_data() {
     'help' => t('The extension of the file.'),
     'real field' => 'filename',
     'field' => array(
-      'handler' => 'views_handler_field_file_extension',
+      'plugin_id' => 'field_file_extension',
       'click sortable' => FALSE,
      ),
   );
@@ -124,7 +124,7 @@ function system_views_data() {
     'title' => t('Size'),
     'help' => t('The size of the file.'),
     'field' => array(
-      'handler' => 'views_handler_field_file_size',
+      'plugin_id' => 'field_file_size',
       'click sortable' => TRUE,
      ),
     'sort' => array(
@@ -140,14 +140,14 @@ function system_views_data() {
     'title' => t('Status'),
     'help' => t('The status of the file.'),
     'field' => array(
-      'handler' => 'views_handler_field_file_status',
+      'plugin_id' => 'field_file_status',
       'click sortable' => TRUE,
      ),
     'sort' => array(
       'plugin_id' => 'standard',
     ),
     'filter' => array(
-      'handler' => 'views_handler_filter_file_status',
+      'plugin_id' => 'filter_file_status',
     ),
   );
 
@@ -516,7 +516,7 @@ function system_views_data() {
       'name field' => 'type', // the field to display in the summary.
     ),
     'filter' => array(
-      'handler' => 'views_handler_filter_system_type',
+      'plugin_id' => 'filter_system_type',
     ),
     'sort' => array(
       'plugin_id' => 'standard',
-- 
GitLab