You are here

public function SlickTextFormatter::buildElements in Slick Carousel 7.3

Same name and namespace in other branches
  1. 8.2 src/Plugin/Field/FieldFormatter/SlickTextFormatter.php \Drupal\slick\Plugin\Field\FieldFormatter\SlickTextFormatter::buildElements()

Build the slick carousel elements.

1 call to SlickTextFormatter::buildElements()
SlickTextFormatter::viewElements in src/Plugin/Field/FieldFormatter/SlickTextFormatter.php
Implements hook_field_formatter_view().

File

src/Plugin/Field/FieldFormatter/SlickTextFormatter.php, line 78

Class

SlickTextFormatter
Plugin implementation of the 'Slick Text' formatter.

Namespace

Drupal\slick\Plugin\Field\FieldFormatter

Code

public function buildElements(array &$build, $items) {
  $settings = $build['settings'];

  // The ProcessedText element already handles cache context & tag bubbling.
  // @see \Drupal\filter\Element\ProcessedText::preRenderText()
  foreach ($items as $item) {
    $text = _text_sanitize($this->fieldInstance, $settings['langcode'], $item, 'value');
    $build['items'][] = [
      '#markup' => $text,
    ];
    unset($text);
  }
}