public function DisplayFieldCopy::build in Display Field Copy 2.x
Same name and namespace in other branches
- 8 src/Plugin/DsField/DisplayFieldCopy.php \Drupal\display_field_copy\Plugin\DsField\DisplayFieldCopy::build()
File
- src/
Plugin/ DsField/ DisplayFieldCopy.php, line 82
Class
- DisplayFieldCopy
- Defines a generic dynamic field that holds a copy of an exisitng core field.
Namespace
Drupal\display_field_copy\Plugin\DsFieldCode
public function build() {
$formatter = $this
->getFormatter([
'type' => $this
->getFieldConfiguration()['formatter'],
]);
$items = $this
->entity()
->get($this
->getRenderKey());
$formatter
->prepareView([
$items
->getIterator()
->getArrayCopy(),
]);
return $formatter
->viewElements($items, $this
->entity()
->language()
->getId());
}