Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a Farm asset type #784

Draft
wants to merge 1 commit into
base: 3.x
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

### Fixed

- [Remove data_table from existing plan_record entity type definition #829](https://github.com/farmOS/farmOS/pull/829)
Expand Down
9 changes: 9 additions & 0 deletions docs/guide/mapping.md
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions farm.profile
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down
17 changes: 17 additions & 0 deletions modules/asset/farm/config/install/asset.type.farm.yml
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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 {

}