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

80 lines
1.4 KiB
PHP

<?php
/**
* @file
* Quantity module.
*/
/**
* Define information about available quantity measures.
*
* @return array
* Returns an array of measure information.
*/
function quantity_measures() {
return [
'count' => [
'label' => t('Count'),
],
'length' => [
'label' => t('Length/depth'),
],
'weight' => [
'label' => t('Weight'),
],
'area' => [
'label' => t('Area'),
],
'volume' => [
'label' => t('Volume'),
],
'time' => [
'label' => t('Time'),
],
'temperature' => [
'label' => t('Temperature'),
],
'pressure' => [
'label' => t('Pressure'),
],
'water_content' => [
'label' => t('Water content'),
],
'value' => [
'label' => t('Value'),
],
'rate' => [
'label' => t('Rate'),
],
'rating' => [
'label' => t('Rating'),
],
'ratio' => [
'label' => t('Ratio'),
],
'probability' => [
'label' => t('Probability'),
],
];
}
/**
* Define available options for the Measure field.
*/
function quantity_measure_options() {
// Start an empty options array.
$options = [];
// Load information about measures.
$measures = quantity_measures();
// Iterate through the measures and build a list of options.
foreach ($measures as $measure => $data) {
$options[$measure] = $data['label'];
}
// Return the array of options.
return $options;
}