Plugin implementation of the 'text_default' formatter.
@FieldFormatter(
id = "text_default",
module = "text",
label = @Translation("Default"),
field_types = {
"text",
"text_long",
"text_with_summary"
},
edit = {
"editor" = "direct"
}
)
Expanded class hierarchy of TextDefaultFormatter
class TextDefaultFormatter extends FormatterBase {
/**
* Implements Drupal\field\Plugin\Type\Formatter\FormatterInterface::viewElements().
*/
public function viewElements(EntityInterface $entity, $langcode, array $items) {
$elements = array();
foreach ($items as $delta => $item) {
$output = text_sanitize($this->instance['settings']['text_processing'], $langcode, $item, 'value');
$elements[$delta] = array(
'#markup' => $output,
);
}
return $elements;
}
}