Add a farm_comment_plan module for commenting on plans.

This commit is contained in:
Michael Stenta 2024-02-12 15:01:59 -05:00
parent 5f62c36cc2
commit 533a42077d
7 changed files with 124 additions and 0 deletions

View File

@ -62,6 +62,7 @@ function farm_modules() {
'farm_import_kml' => t('KML asset importer'),
'farm_comment_asset' => t('Asset comments'),
'farm_comment_log' => t('Log comments'),
'farm_comment_plan' => t('Plan comments'),
'farm_map_mapbox' => t('Mapbox map layers: Satellite, Outdoors'),
'farm_api_default_consumer' => t('Default API Consumer'),
'farm_fieldkit' => t('Field Kit integration'),

View File

@ -0,0 +1,10 @@
langcode: en
status: true
dependencies:
enforced:
module:
- farm_comment_plan
id: plan
label: 'Plan comment'
target_entity_type_id: plan
description: ''

View File

@ -0,0 +1,31 @@
langcode: en
status: true
dependencies:
config:
- comment.type.plan
- field.field.comment.plan.comment_body
enforced:
module:
- farm_comment_plan
module:
- text
id: comment.plan.default
targetEntityType: comment
bundle: plan
mode: default
content:
author:
weight: 0
region: content
settings: { }
third_party_settings: { }
comment_body:
type: text_textarea
weight: 1
region: content
settings:
rows: 5
placeholder: ''
third_party_settings: { }
hidden:
subject: true

View File

@ -0,0 +1,29 @@
langcode: en
status: true
dependencies:
config:
- comment.type.plan
- field.field.comment.plan.comment_body
enforced:
module:
- farm_comment_plan
module:
- text
id: comment.plan.default
targetEntityType: comment
bundle: plan
mode: default
content:
comment_body:
type: text_default
label: hidden
settings: { }
third_party_settings: { }
weight: 0
region: content
links:
settings: { }
third_party_settings: { }
weight: 1
region: content
hidden: { }

View File

@ -0,0 +1,23 @@
langcode: en
status: true
dependencies:
config:
- comment.type.plan
- field.storage.comment.comment_body
enforced:
module:
- farm_comment_plan
module:
- text
id: comment.plan.comment_body
field_name: comment_body
entity_type: comment
bundle: plan
label: Comment
description: ''
required: true
translatable: true
default_value: { }
default_value_callback: ''
settings: { }
field_type: text_long

View File

@ -0,0 +1,8 @@
name: Plan comments
description: Enables comments on farmOS plans.
type: module
package: farmOS
core_version_requirement: ^9
dependencies:
- farm:farm_comment
- farm:plan

View File

@ -0,0 +1,22 @@
<?php
/**
* @file
* Contains farm_comment_plan.module.
*/
use Drupal\Core\Entity\EntityTypeInterface;
/**
* Implements hook_entity_base_field_info().
*/
function farm_comment_plan_entity_base_field_info(EntityTypeInterface $entity_type) {
$fields = [];
// Add comment base field to plans.
if ($entity_type->id() == 'plan') {
$fields['comment'] = farm_comment_base_field_definition('plan');
}
return $fields;
}