mirror of
https://github.com/farmOS/farmOS.git
synced 2024-02-23 11:37:38 +01:00
a760005c7c
**Why?** Make it possible for novice users to find data and explore connections between assets/logs without needing to totally grok the farmOS data model first. i.e. * Navigate from a plant asset to a list of all the seed/plant assets with the same crop/variety * Navigate from a plant asset to a list of all the seed/plant assets from the same season * Navigate from a log in the compost category to a list of all the logs in the compost category * Navigate from a material asset to a list of all the materials with the same material type
45 lines
1.3 KiB
PHP
45 lines
1.3 KiB
PHP
<?php
|
|
|
|
/**
|
|
* @file
|
|
* Provides Views data for farm_ui_views.module.
|
|
*/
|
|
|
|
/**
|
|
* Implements hook_views_data_alter().
|
|
*/
|
|
function farm_ui_views_views_data_alter(array &$data) {
|
|
|
|
// Provide an asset_or_location argument for views of logs.
|
|
if (isset($data['log_field_data'])) {
|
|
$data['log_field_data']['asset_or_location'] = [
|
|
'title' => t('Asset or location'),
|
|
'help' => t('Assets that are referenced by the asset or location field on the log.'),
|
|
'argument' => [
|
|
'id' => 'asset_or_location',
|
|
],
|
|
];
|
|
}
|
|
|
|
// Provide an asset_taxonomy_term_reference argument for views of assets.
|
|
if (isset($data['asset_field_data'])) {
|
|
$data['asset_field_data']['asset_taxonomy_term_reference'] = [
|
|
'title' => t('Asset Taxonomy Term Reference'),
|
|
'help' => t('Taxonomy Terms that are referenced by the asset.'),
|
|
'argument' => [
|
|
'id' => 'entity_taxonomy_term_reference',
|
|
],
|
|
];
|
|
}
|
|
|
|
// Provide a log_taxonomy_term_reference argument for views of logs.
|
|
if (isset($data['log_field_data'])) {
|
|
$data['log_field_data']['log_taxonomy_term_reference'] = [
|
|
'title' => t('Log Taxonomy Term Reference'),
|
|
'help' => t('Taxonomy Terms that are referenced by the log.'),
|
|
'argument' => [
|
|
'id' => 'entity_taxonomy_term_reference',
|
|
],
|
|
];
|
|
}
|
|
}
|