Skip to content
Snippets Groups Projects
Commit 5019a190 authored by Daniel Wehner's avatar Daniel Wehner Committed by Tim Plunkett
Browse files

convert system stuff

parent 85f7dfc3
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -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.
*/
......
......@@ -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)) {
......
......@@ -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.
*/
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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();
......
......@@ -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');
......
......@@ -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',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment