QuantityViewsData.php in farmOS 2.x
File
modules/core/quantity/src/QuantityViewsData.php
View source
<?php
namespace Drupal\quantity;
use Drupal\entity\EntityViewsData;
class QuantityViewsData extends EntityViewsData {
public function getViewsData() {
$data = parent::getViewsData();
$fraction_fields = [
'numerator' => 'value__numerator',
'denominator' => 'value__denominator',
];
$data['quantity']['value'] = [
'title' => $this
->t('Value'),
'help' => $this
->t('Value of the quantity, in decimal format.'),
'real field' => 'value__numerator',
'field' => [
'id' => 'fraction',
'additional fields' => $fraction_fields,
'click sortable' => TRUE,
],
'sort' => [
'id' => 'fraction',
'additional fields' => $fraction_fields,
],
'filter' => [
'id' => 'fraction',
'additional fields' => $fraction_fields,
],
];
return $data;
}
}