public function BlazyStylePluginBase::buildElement in Blazy 7
Same name and namespace in other branches
- 8.2 src/Dejavu/BlazyStylePluginBase.php \Drupal\blazy\Dejavu\BlazyStylePluginBase::buildElement()
- 8 src/Dejavu/BlazyStylePluginBase.php \Drupal\blazy\Dejavu\BlazyStylePluginBase::buildElement()
Returns an individual row/element content.
File
- src/
Dejavu/ BlazyStylePluginBase.php, line 43
Class
- BlazyStylePluginBase
- A base for blazy views integration to have re-usable methods in one place.
Namespace
Drupal\blazy\DejavuCode
public function buildElement(array &$element, $row, $index) {
$settings =& $element['settings'];
$item_id = empty($settings['item_id']) ? 'box' : $settings['item_id'];
// Add main image fields if so configured.
if (!empty($settings['image'])) {
// Supports individual grid/box image style either inline IMG, or CSS.
$image = $this
->getImageRenderable($settings, $row, $index);
$element['item'] = $this
->getImageItem($image);
$element[$item_id] = empty($image['rendered']) ? [] : $image['rendered'];
}
// Add caption fields if so configured.
$element['caption'] = $this
->getCaption($index, $settings);
// Add layout field, may be a list field, or builtin layout options.
if (!empty($settings['layout'])) {
$this
->getLayout($settings, $index);
}
}