You are here

public function BlazyStylePluginTrait::getFieldRendered in Blazy 8

Same name and namespace in other branches
  1. 8.2 src/Dejavu/BlazyStylePluginTrait.php \Drupal\blazy\Dejavu\BlazyStylePluginTrait::getFieldRendered()
  2. 7 src/Dejavu/BlazyStylePluginTrait.php \Drupal\blazy\Dejavu\BlazyStylePluginTrait::getFieldRendered()

Returns the rendered field, either string or array.

1 call to BlazyStylePluginTrait::getFieldRendered()
BlazyStylePluginTrait::getCaption in src/Dejavu/BlazyStylePluginTrait.php
Returns the rendered caption fields.

File

src/Dejavu/BlazyStylePluginTrait.php, line 269

Class

BlazyStylePluginTrait
A Trait common for optional views style plugins.

Namespace

Drupal\blazy\Dejavu

Code

public function getFieldRendered($index, $field_name = '', $restricted = FALSE) {
  if (!empty($field_name) && ($output = $this
    ->getField($index, $field_name))) {
    return is_array($output) ? $output : [
      '#markup' => $restricted ? Xss::filterAdmin($output) : $output,
    ];
  }
  return [];
}