Extension.php in Views (for Drupal 7) 8.3
Definition of views_handler_field_file_extension.
Namespace
Views\file\Plugin\views\fieldFile
lib/Views/file/Plugin/views/field/Extension.phpView source
<?php
/**
* @file
* 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
*
* @Plugin(
* id = "file_extension",
* module = "file"
* )
*/
class Extension extends FieldPluginBase {
function render($values) {
$value = $this
->get_value($values);
if (preg_match('/\\.([^\\.]+)$/', $value, $match)) {
return $this
->sanitizeValue($match[1]);
}
}
}