Split out farm_comment_asset and farm_comment_log modules.
This commit is contained in:
parent
68e6c9da77
commit
3ea84c92ad
|
@ -60,7 +60,8 @@ function farm_modules() {
|
|||
'farm_import_csv' => t('CSV importer'),
|
||||
'farm_export_kml' => t('KML exporter'),
|
||||
'farm_import_kml' => t('KML asset importer'),
|
||||
'farm_comment' => t('Comments on assets/logs'),
|
||||
'farm_comment_asset' => t('Asset comments'),
|
||||
'farm_comment_log' => t('Log comments'),
|
||||
'farm_map_mapbox' => t('Mapbox map layers: Satellite, Outdoors'),
|
||||
'farm_api_default_consumer' => t('Default API Consumer'),
|
||||
'farm_fieldkit' => t('Field Kit integration'),
|
||||
|
|
|
@ -5,5 +5,3 @@ package: farmOS
|
|||
core_version_requirement: ^9
|
||||
dependencies:
|
||||
- drupal:comment
|
||||
- farm:asset
|
||||
- log:log
|
||||
|
|
|
@ -6,23 +6,8 @@
|
|||
*/
|
||||
|
||||
use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
|
||||
use Drupal\Core\Entity\EntityTypeInterface;
|
||||
use Drupal\entity\BundleFieldDefinition;
|
||||
|
||||
/**
|
||||
* Implements hook_entity_base_field_info().
|
||||
*/
|
||||
function farm_comment_entity_base_field_info(EntityTypeInterface $entity_type) {
|
||||
$fields = [];
|
||||
|
||||
// Add comment base field to assets and logs.
|
||||
if (in_array($entity_type->id(), ['asset', 'log'])) {
|
||||
$fields['comment'] = farm_comment_base_field_definition($entity_type->id());
|
||||
}
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function for generating a standard comment base field definition.
|
||||
*
|
||||
|
|
|
@ -3,7 +3,7 @@ status: true
|
|||
dependencies:
|
||||
enforced:
|
||||
module:
|
||||
- farm_comment
|
||||
- farm_comment_asset
|
||||
id: asset_comment
|
||||
label: 'Asset comment'
|
||||
target_entity_type_id: asset
|
|
@ -6,7 +6,7 @@ dependencies:
|
|||
- field.field.comment.asset_comment.comment_body
|
||||
enforced:
|
||||
module:
|
||||
- farm_comment
|
||||
- farm_comment_asset
|
||||
module:
|
||||
- text
|
||||
id: comment.asset_comment.default
|
|
@ -6,7 +6,7 @@ dependencies:
|
|||
- field.field.comment.asset_comment.comment_body
|
||||
enforced:
|
||||
module:
|
||||
- farm_comment
|
||||
- farm_comment_asset
|
||||
module:
|
||||
- text
|
||||
id: comment.asset_comment.default
|
|
@ -6,7 +6,7 @@ dependencies:
|
|||
- field.storage.comment.comment_body
|
||||
enforced:
|
||||
module:
|
||||
- farm_comment
|
||||
- farm_comment_asset
|
||||
module:
|
||||
- text
|
||||
id: comment.asset_comment.comment_body
|
|
@ -0,0 +1,8 @@
|
|||
name: Asset comments
|
||||
description: Enables comments on farmOS assets.
|
||||
type: module
|
||||
package: farmOS
|
||||
core_version_requirement: ^9
|
||||
dependencies:
|
||||
- farm:asset
|
||||
- farm:farm_comment
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains farm_comment_asset.module.
|
||||
*/
|
||||
|
||||
use Drupal\Core\Entity\EntityTypeInterface;
|
||||
|
||||
/**
|
||||
* Implements hook_entity_base_field_info().
|
||||
*/
|
||||
function farm_comment_asset_entity_base_field_info(EntityTypeInterface $entity_type) {
|
||||
$fields = [];
|
||||
|
||||
// Add comment base field to assets.
|
||||
if ($entity_type->id() == 'asset') {
|
||||
$fields['comment'] = farm_comment_base_field_definition('asset');
|
||||
}
|
||||
|
||||
return $fields;
|
||||
}
|
|
@ -3,7 +3,7 @@ status: true
|
|||
dependencies:
|
||||
enforced:
|
||||
module:
|
||||
- farm_comment
|
||||
- farm_comment_log
|
||||
id: log_comment
|
||||
label: 'Log comment'
|
||||
target_entity_type_id: log
|
|
@ -6,7 +6,7 @@ dependencies:
|
|||
- field.field.comment.log_comment.comment_body
|
||||
enforced:
|
||||
module:
|
||||
- farm_comment
|
||||
- farm_comment_log
|
||||
module:
|
||||
- text
|
||||
id: comment.log_comment.default
|
|
@ -6,7 +6,7 @@ dependencies:
|
|||
- field.field.comment.log_comment.comment_body
|
||||
enforced:
|
||||
module:
|
||||
- farm_comment
|
||||
- farm_comment_log
|
||||
module:
|
||||
- text
|
||||
id: comment.log_comment.default
|
|
@ -6,7 +6,7 @@ dependencies:
|
|||
- field.storage.comment.comment_body
|
||||
enforced:
|
||||
module:
|
||||
- farm_comment
|
||||
- farm_comment_log
|
||||
module:
|
||||
- text
|
||||
id: comment.log_comment.comment_body
|
|
@ -0,0 +1,8 @@
|
|||
name: Log comments
|
||||
description: Enables comments on farmOS logs.
|
||||
type: module
|
||||
package: farmOS
|
||||
core_version_requirement: ^9
|
||||
dependencies:
|
||||
- farm:farm_comment
|
||||
- log:log
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains farm_comment_log.module.
|
||||
*/
|
||||
|
||||
use Drupal\Core\Entity\EntityTypeInterface;
|
||||
|
||||
/**
|
||||
* Implements hook_entity_base_field_info().
|
||||
*/
|
||||
function farm_comment_log_entity_base_field_info(EntityTypeInterface $entity_type) {
|
||||
$fields = [];
|
||||
|
||||
// Add comment base field to logs.
|
||||
if ($entity_type->id() == 'log') {
|
||||
$fields['comment'] = farm_comment_base_field_definition('log');
|
||||
}
|
||||
|
||||
return $fields;
|
||||
}
|
Loading…
Reference in New Issue