You are here

public function Type::render in File Entity (fieldable files) 8.2

Renders the type of the field.

Parameters

ResultRow $values: Row Result Values.

Return value

string Returns the type of the field.

Overrides FieldPluginBase::render

File

src/Plugin/views/field/Type.php, line 27

Class

Type
Field Handler to show the type of a field.

Namespace

Drupal\file_entity\Plugin\views\field

Code

public function render(ResultRow $values) {
  $value = $this
    ->getValue($values);
  if ($file_entity = FileType::load($value)) {
    return $file_entity
      ->label();
  }
  else {
    return t('Undefined');
  }
}