farmOS/modules/farm/farm_soil/farm_soil_compost/farm_soil_compost.module

62 lines
1.3 KiB
Plaintext

<?php
/**
* @file
* Code for the Farm Soil: Compost feature.
*/
include_once 'farm_soil_compost.features.inc';
/**
* Implements hook_farm_ui_entities().
*/
function farm_soil_compost_farm_ui_entities() {
return array(
'farm_asset' => array(
'compost' => array(
'label' => t('Compost'),
'label_plural' => t('Compost'),
'view' => 'farm_compost',
),
),
);
}
/**
* Implements hook_farm_ui_entity_views().
*/
function farm_soil_compost_farm_ui_entity_views($entity_type, $bundle, $entity) {
$views = array();
// Return a list of Views to include on Compost assets.
if ($entity_type == 'farm_asset' && $bundle == 'compost') {
$views[] = array(
'name' => 'farm_log_movement',
'weight' => 100,
);
$views[] = array(
'name' => 'farm_asset_children',
'display' => 'page',
'title' => t('Children'),
'weight' => 110,
);
}
// Show compost in area pages.
elseif ($entity_type == 'taxonomy_term' && $entity->vocabulary_machine_name == 'farm_areas') {
$views[] = array(
'name' => 'farm_compost',
);
}
return $views;
}
/**
* Implements hook_farm_log_categories().
*/
function farm_soil_compost_farm_log_categories() {
// Provide an "Compost" log category.
return array('Compost');
}