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

91 lines
1.7 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_asset_views().
*/
function farm_soil_compost_farm_ui_asset_views($farm_asset) {
// If the entity is not a compost bail.
if ($farm_asset->type != 'compost') {
return array();
}
// Return a list of Views to include on Compost assets.
return array(
array(
'name' => 'farm_log_activity',
'weight' => 0,
),
array(
'name' => 'farm_log_observation',
'weight' => 10,
),
array(
'name' => 'farm_log_input',
'weight' => 50,
),
array(
'name' => 'farm_log_harvest',
'weight' => 60,
),
array(
'name' => 'farm_log_movement',
'weight' => 100,
),
array(
'name' => 'farm_asset_children',
'display' => 'page',
'title' => t('Children'),
'weight' => 110,
),
);
}
/**
* Implements hook_farm_ui_taxonomy_views().
*/
function farm_soil_compost_farm_ui_taxonomy_views($term) {
// If the term is not an area, bail.
if ($term->vocabulary_machine_name != 'farm_areas') {
return array();
}
// Return a list of Views to include on Areas.
return array(
array(
'name' => 'farm_compost',
),
);
}
/**
* Implements hook_farm_log_categories().
*/
function farm_soil_compost_farm_log_categories() {
// Provide an "Compost" log category.
return array('Compost');
}