CountryCodeFormatter.php in Country 8
File
src/Plugin/Field/FieldFormatter/CountryCodeFormatter.php
View source
<?php
namespace Drupal\country\Plugin\Field\FieldFormatter;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Field\FormatterBase;
class CountryCodeFormatter extends FormatterBase {
public function viewElements(FieldItemListInterface $items, $langcode) {
$elements = [];
foreach ($items as $delta => $item) {
$elements[$delta] = [
'#markup' => $item->value,
];
}
return $elements;
}
}