3
0
Fork 0
mirror of https://github.com/farmOS/farmOS.git synced 2024-02-23 11:37:38 +01:00

Display Animals View on animal type and animal group pages.

This commit is contained in:
Michael Stenta 2015-03-21 13:40:38 -04:00
parent 884f939b45
commit 17b25ed470

View file

@ -47,15 +47,35 @@ function farm_livestock_farm_asset_view_views($farm_asset) {
*/
function farm_livestock_farm_taxonomy_term_view_views($term) {
// If the term is not an area, bail.
if ($term->vocabulary_machine_name != 'farm_areas') {
return;
// Start a list of View names.
$views = array();
// Switch logic depending on the vocabulary.
switch ($term->vocabulary_machine_name) {
// Farm areas:
case 'farm_areas':
$views[] = 'farm_animals';
break;
// Farm animal groups:
case 'farm_animal_groups':
$views[] = array(
'name' => 'farm_animals',
'arg' => 2,
);
break;
// Farm animal types:
case 'farm_animal_types':
$views[] = array(
'name' => 'farm_animals',
'arg' => 3,
);
break;
}
// Return a list of Views to include on Areas.
return array(
'farm_animals',
);
return $views;
}
/**