AggregatorXSSFormatter.php
Same filename in other branches
Namespace
Drupal\aggregator\Plugin\Field\FieldFormatterFile
-
core/
modules/ aggregator/ src/ Plugin/ Field/ FieldFormatter/ AggregatorXSSFormatter.php
View source
<?php
namespace Drupal\aggregator\Plugin\Field\FieldFormatter;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Field\FormatterBase;
/**
* Plugin implementation of the 'aggregator_xss' formatter.
*
* @FieldFormatter(
* id = "aggregator_xss",
* label = @Translation("Aggregator XSS"),
* description = @Translation("Filter output for aggregator items"),
* field_types = {
* "string",
* "string_long",
* }
* )
*/
class AggregatorXSSFormatter extends FormatterBase {
/**
* {@inheritdoc}
*/
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;
}
}
Classes
Title | Deprecated | Summary |
---|---|---|
AggregatorXSSFormatter | Plugin implementation of the 'aggregator_xss' formatter. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.