Add a Farm asset type #784

This commit is contained in:
Michael Stenta 2024-01-29 15:42:28 -05:00
parent 96bf17bc69
commit 2e522e163f
8 changed files with 73 additions and 0 deletions

View File

@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Added
- [Add a Farm asset type #784](https://github.com/farmOS/farmOS/pull/784)
## [3.1.0] 2024-02-02
### Added

View File

@ -20,6 +20,15 @@ designated as a location.
When you're done modifying your area, remember to click the Save button at the
bottom of the page to save your changes.
## Farm Assets
In some situations, it may be useful to organize Land Assets under one or more
Farm Assets, which represent different locations or operations that are
managed independently. farmOS includes a Farm Asset type in an optional module
that can be turned on in those scenarios. Land Assets (and other locations) can
be organized under Farm Assets in the location hierarchy to make their
relationship clear.
## Map controls
### Zooming

View File

@ -27,6 +27,7 @@ included with farmOS define the following Asset types:
- Material
- Product
- Group*
- Farm*
*Group Assets are unique in that they can "contain" other Assets as "group
members". This is a flexible feature that can be used for many purposes. One
@ -36,6 +37,11 @@ to see all the Groups that an Asset was a member of in the past, when/why they
were moved, etc. See [farmOS Group Membership Logic](/model/logic/group) for
more information.
*Farm Assets can be used to model multiple "farms" within a single farmOS
instance/dataset. This can be useful in situations where there are multiple
different locations with their own Land Assets, Equipment Assets, etc, or as a
place to store farm-level data that may not fit nicely in more granular records.
## ID
Each Asset will be assigned two unique IDs in the database: a universally unique

View File

@ -52,6 +52,7 @@ function farm_modules() {
'farm_sensor' => t('Sensor assets'),
'farm_compost' => t('Compost assets'),
'farm_group' => t('Group assets'),
'farm_farm' => t('Farm assets'),
'farm_transplanting' => t('Transplanting logs'),
'farm_lab_test' => t('Lab test logs'),
'farm_birth' => t('Birth logs'),

View File

@ -0,0 +1,17 @@
langcode: en
status: true
dependencies:
enforced:
module:
- farm_farm
module:
- farm_location
id: farm
label: Farm
description: ''
workflow: asset_default
new_revision: true
third_party_settings:
farm_location:
is_location: true
is_fixed: true

View File

@ -0,0 +1,11 @@
langcode: en
status: true
dependencies:
enforced:
module:
- farm_farm
id: asset_farm
color: purple
conditions:
asset_type:
- farm

View File

@ -0,0 +1,8 @@
name: Farm asset
description: Adds a Farm asset type.
type: module
package: farmOS Assets
core_version_requirement: ^10
dependencies:
- farm:asset
- farm:farm_entity

View File

@ -0,0 +1,17 @@
<?php
namespace Drupal\farm_farm\Plugin\Asset\AssetType;
use Drupal\farm_entity\Plugin\Asset\AssetType\FarmAssetType;
/**
* Provides the farm asset type.
*
* @AssetType(
* id = "farm",
* label = @Translation("Farm"),
* )
*/
class Farm extends FarmAssetType {
}