94 lines
1.8 KiB
Plaintext
94 lines
1.8 KiB
Plaintext
<?php
|
|
/**
|
|
* @file
|
|
* Code for the Farm Equipment feature.
|
|
*/
|
|
|
|
include_once 'farm_equipment.features.inc';
|
|
|
|
/**
|
|
* Implements hook_farm_ui_entities().
|
|
*/
|
|
function farm_equipment_farm_ui_entities() {
|
|
return array(
|
|
'farm_asset' => array(
|
|
'equipment' => array(
|
|
'label' => t('Equipment'),
|
|
'label_plural' => t('Equipment'),
|
|
'view' => 'farm_equipment',
|
|
),
|
|
),
|
|
'log' => array(
|
|
'farm_maintenance' => array(
|
|
'label' => t('Maintenance'),
|
|
'label_plural' => t('Maintenance'),
|
|
'view' => 'farm_log_maintenance',
|
|
'farm_asset' => 'equipment',
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Implements hook_farm_ui_asset_views().
|
|
*/
|
|
function farm_equipment_farm_ui_asset_views($farm_asset) {
|
|
|
|
// If the entity is not equipment, bail.
|
|
if ($farm_asset->type != 'equipment') {
|
|
return array();
|
|
}
|
|
|
|
// Return a list of Views to include on Equipment.
|
|
return array(
|
|
array(
|
|
'name' => 'farm_log_activity',
|
|
'weight' => 0,
|
|
),
|
|
array(
|
|
'name' => 'farm_log_observation',
|
|
'weight' => 10,
|
|
),
|
|
array(
|
|
'name' => 'farm_log_maintenance',
|
|
'weight' => 20,
|
|
),
|
|
array(
|
|
'name' => 'farm_log_input',
|
|
'weight' => 50,
|
|
),
|
|
array(
|
|
'name' => 'farm_log_movement',
|
|
'weight' => 100,
|
|
),
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Implements hook_farm_ui_taxonomy_views().
|
|
*/
|
|
function farm_equipment_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_equipment',
|
|
'weight' => -10,
|
|
),
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Implements hook_farm_log_categories().
|
|
*/
|
|
function farm_equipment_farm_log_categories() {
|
|
|
|
// Provide an "Equipment" log category.
|
|
return array('Equipment');
|
|
}
|