You are here

public function BlazyStyleBaseTrait::getFieldRenderable in Blazy 7

Same name and namespace in other branches
  1. 8.2 src/Dejavu/BlazyStyleBaseTrait.php \Drupal\blazy\Dejavu\BlazyStyleBaseTrait::getFieldRenderable()
  2. 8 src/Dejavu/BlazyStyleBaseTrait.php \Drupal\blazy\Dejavu\BlazyStyleBaseTrait::getFieldRenderable()

Returns the renderable array of field containing rendered and raw data.

File

src/Dejavu/BlazyStyleBaseTrait.php, line 115

Class

BlazyStyleBaseTrait
A Trait common for optional views style plugins.

Namespace

Drupal\blazy\Dejavu

Code

public function getFieldRenderable($row, $index, $field_name = '', $multiple = FALSE) {

  // Be sure to not check "Use field template" under "Style settings" to have
  // renderable array to work with, otherwise flattened string!
  $field = $this->view->field[$field_name]->handler_type . '_' . $field_name;
  return $multiple && isset($row->{$field}) ? $row->{$field} : (isset($row->{$field}[0]) ? $row->{$field}[0] : '');
}