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