Commit 9b956ea6 authored by dawehner's avatar dawehner Committed by tim.plunkett

move some classes in seperated files

parent d37ab861
......@@ -1644,60 +1644,6 @@ function options_form(&$form, &$form_state) {
function broken() { return TRUE; }
}
/**
* Render a numeric value as a size.
*
* @ingroup views_field_handlers
*/
class views_handler_field_file_size extends FieldPluginBase {
function option_definition() {
$options = parent::option_definition();
$options['file_size_display'] = array('default' => 'formatted');
return $options;
}
function options_form(&$form, &$form_state) {
parent::options_form($form, $form_state);
$form['file_size_display'] = array(
'#title' => t('File size display'),
'#type' => 'select',
'#options' => array(
'formatted' => t('Formatted (in KB or MB)'),
'bytes' => t('Raw bytes'),
),
);
}
function render($values) {
$value = $this->get_value($values);
if ($value) {
switch ($this->options['file_size_display']) {
case 'bytes':
return $value;
case 'formatted':
default:
return format_size($value);
}
}
else {
return '';
}
}
}
/**
* A handler to run a field through simple XSS filtering.
*
* @ingroup views_field_handlers
*/
class views_handler_field_xss extends FieldPluginBase {
function render($values) {
$value = $this->get_value($values);
return $this->sanitize_value($value, 'xss');
}
}
/**
* @}
......
<?php
/**
* @file
* Definition of Drupal\views\Plugins\views\field\FileSize
*/
namespace Drupal\views\Plugins\views\field;
use Drupal\views\Plugins\views\field\FieldPluginBase;
/**
* Render a numeric value as a size.
*
* @ingroup views_field_handlers
*/
class FileSize extends FieldPluginBase {
function option_definition() {
$options = parent::option_definition();
$options['file_size_display'] = array('default' => 'formatted');
return $options;
}
function options_form(&$form, &$form_state) {
parent::options_form($form, $form_state);
$form['file_size_display'] = array(
'#title' => t('File size display'),
'#type' => 'select',
'#options' => array(
'formatted' => t('Formatted (in KB or MB)'),
'bytes' => t('Raw bytes'),
),
);
}
function render($values) {
$value = $this->get_value($values);
if ($value) {
switch ($this->options['file_size_display']) {
case 'bytes':
return $value;
case 'formatted':
default:
return format_size($value);
}
}
else {
return '';
}
}
}
<?php
/**
* @file
* Definition of Drupal\views\Plugins\views\field\Xss
*/
namespace Drupal\views\Plugins\views\field;
use Drupal\views\Plugins\views\field\FieldPluginBase;
/**
* A handler to run a field through simple XSS filtering.
*
* @ingroup views_field_handlers
*/
class Xss extends FieldPluginBase {
function render($values) {
$value = $this->get_value($values);
return $this->sanitize_value($value, 'xss');
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment