function AggregatorXSSFormatter::viewElements

Same name and namespace in other branches
  1. 9 core/modules/aggregator/src/Plugin/Field/FieldFormatter/AggregatorXSSFormatter.php \Drupal\aggregator\Plugin\Field\FieldFormatter\AggregatorXSSFormatter::viewElements()

Overrides FormatterInterface::viewElements

File

core/modules/aggregator/src/Plugin/Field/FieldFormatter/AggregatorXSSFormatter.php, line 26

Class

AggregatorXSSFormatter
Plugin implementation of the 'aggregator_xss' formatter.

Namespace

Drupal\aggregator\Plugin\Field\FieldFormatter

Code

public function viewElements(FieldItemListInterface $items, $langcode) {
    $elements = [];
    foreach ($items as $delta => $item) {
        $elements[$delta] = [
            '#type' => 'markup',
            '#markup' => $item->value,
            '#allowed_tags' => _aggregator_allowed_tags(),
        ];
    }
    return $elements;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.