You are here

public function BlazyStylePluginTrait::getFieldRendered in Blazy 7

Same name and namespace in other branches
  1. 8.2 src/Dejavu/BlazyStylePluginTrait.php \Drupal\blazy\Dejavu\BlazyStylePluginTrait::getFieldRendered()
  2. 8 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 145

Class

BlazyStylePluginTrait
A Trait common for optional views style plugins for slick, etc.

Namespace

Drupal\blazy\Dejavu

Code

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