Skip to content

Commit

Permalink
Add a Farm asset type #784
Browse files Browse the repository at this point in the history
  • Loading branch information
mstenta committed Feb 2, 2024
1 parent 220c99c commit 040934a
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- [Announce new releases on farmOS.discourse.group #780](https://github.com/farmOS/farmOS/pull/780)
- [Add a Farm asset type #784](https://github.com/farmOS/farmOS/pull/784)

## [3.0.1] 2024-01-18

Expand Down
9 changes: 9 additions & 0 deletions docs/guide/mapping.md
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions docs/model/type/asset.md
Expand Up @@ -26,6 +26,7 @@ included with farmOS define the following Asset types:
- Water
- Material
- 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
Expand All @@ -35,6 +36,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
Expand Down
1 change: 1 addition & 0 deletions farm.profile
Expand Up @@ -51,6 +51,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'),
Expand Down
17 changes: 17 additions & 0 deletions modules/asset/farm/config/install/asset.type.farm.yml
@@ -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
@@ -0,0 +1,11 @@
langcode: en
status: true
dependencies:
enforced:
module:
- farm_farm
id: asset_farm
color: purple
conditions:
asset_type:
- farm
8 changes: 8 additions & 0 deletions modules/asset/farm/farm_farm.info.yml
@@ -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
17 changes: 17 additions & 0 deletions modules/asset/farm/src/Plugin/Asset/AssetType/Farm.php
@@ -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 {

}

0 comments on commit 040934a

Please sign in to comment.