function price_field_views_data in Price 8
Same name and namespace in other branches
- 3.x price.views.inc \price_field_views_data()
- 2.0.x price.views.inc \price_field_views_data()
- 2.x price.views.inc \price_field_views_data()
- 3.0.x price.views.inc \price_field_views_data()
Implements hook_field_views_data().
Views integration for price fields.
File
- ./
price.views.inc, line 17 - Provide Views data for the Price module.
Code
function price_field_views_data(FieldStorageConfigInterface $field_storage) {
$data = views_field_default_views_data($field_storage);
$field_name = $field_storage
->getName();
foreach ($data as $table_name => $table_data) {
if (isset($table_data[$field_name])) {
$data[$table_name][$field_name . '_number']['field'] = [
'id' => 'numeric',
'field_name' => $table_data[$field_name]['field']['field_name'],
'entity_type' => $table_data[$field_name]['field']['entity_type'],
'label' => t('number from @field_name', [
'@field_name' => $field_name,
]),
];
$data[$table_name][$field_name . '_currency_code']['field'] = [
'id' => 'standard',
'field_name' => $table_data[$field_name]['field']['field_name'],
'entity_type' => $table_data[$field_name]['field']['entity_type'],
'label' => t('currency from @field_name', [
'@field_name' => $field_name,
]),
];
}
}
return $data;
}