mirror of
https://github.com/farmOS/farmOS.git
synced 2024-02-23 11:37:38 +01:00
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_import_csv' => t('CSV importer'),
|
||||||
'farm_export_kml' => t('KML exporter'),
|
'farm_export_kml' => t('KML exporter'),
|
||||||
'farm_import_kml' => t('KML asset importer'),
|
'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_map_mapbox' => t('Mapbox map layers: Satellite, Outdoors'),
|
||||||
'farm_api_default_consumer' => t('Default API Consumer'),
|
'farm_api_default_consumer' => t('Default API Consumer'),
|
||||||
'farm_fieldkit' => t('Field Kit integration'),
|
'farm_fieldkit' => t('Field Kit integration'),
|
||||||
|
|
|
@ -5,5 +5,3 @@ package: farmOS
|
||||||
core_version_requirement: ^9
|
core_version_requirement: ^9
|
||||||
dependencies:
|
dependencies:
|
||||||
- drupal:comment
|
- drupal:comment
|
||||||
- farm:asset
|
|
||||||
- log:log
|
|
||||||
|
|
|
@ -6,23 +6,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
|
use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
|
||||||
use Drupal\Core\Entity\EntityTypeInterface;
|
|
||||||
use Drupal\entity\BundleFieldDefinition;
|
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.
|
* Helper function for generating a standard comment base field definition.
|
||||||
*
|
*
|
||||||
|
|
|
@ -3,7 +3,7 @@ status: true
|
||||||
dependencies:
|
dependencies:
|
||||||
enforced:
|
enforced:
|
||||||
module:
|
module:
|
||||||
- farm_comment
|
- farm_comment_asset
|
||||||
id: asset_comment
|
id: asset_comment
|
||||||
label: 'Asset comment'
|
label: 'Asset comment'
|
||||||
target_entity_type_id: asset
|
target_entity_type_id: asset
|
|
@ -6,7 +6,7 @@ dependencies:
|
||||||
- field.field.comment.asset_comment.comment_body
|
- field.field.comment.asset_comment.comment_body
|
||||||
enforced:
|
enforced:
|
||||||
module:
|
module:
|
||||||
- farm_comment
|
- farm_comment_asset
|
||||||
module:
|
module:
|
||||||
- text
|
- text
|
||||||
id: comment.asset_comment.default
|
id: comment.asset_comment.default
|
|
@ -6,7 +6,7 @@ dependencies:
|
||||||
- field.field.comment.asset_comment.comment_body
|
- field.field.comment.asset_comment.comment_body
|
||||||
enforced:
|
enforced:
|
||||||
module:
|
module:
|
||||||
- farm_comment
|
- farm_comment_asset
|
||||||
module:
|
module:
|
||||||
- text
|
- text
|
||||||
id: comment.asset_comment.default
|
id: comment.asset_comment.default
|
|
@ -6,7 +6,7 @@ dependencies:
|
||||||
- field.storage.comment.comment_body
|
- field.storage.comment.comment_body
|
||||||
enforced:
|
enforced:
|
||||||
module:
|
module:
|
||||||
- farm_comment
|
- farm_comment_asset
|
||||||
module:
|
module:
|
||||||
- text
|
- text
|
||||||
id: comment.asset_comment.comment_body
|
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
|
22
modules/core/comment/modules/asset/farm_comment_asset.module
Normal file
22
modules/core/comment/modules/asset/farm_comment_asset.module
Normal file
|
@ -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:
|
dependencies:
|
||||||
enforced:
|
enforced:
|
||||||
module:
|
module:
|
||||||
- farm_comment
|
- farm_comment_log
|
||||||
id: log_comment
|
id: log_comment
|
||||||
label: 'Log comment'
|
label: 'Log comment'
|
||||||
target_entity_type_id: log
|
target_entity_type_id: log
|
|
@ -6,7 +6,7 @@ dependencies:
|
||||||
- field.field.comment.log_comment.comment_body
|
- field.field.comment.log_comment.comment_body
|
||||||
enforced:
|
enforced:
|
||||||
module:
|
module:
|
||||||
- farm_comment
|
- farm_comment_log
|
||||||
module:
|
module:
|
||||||
- text
|
- text
|
||||||
id: comment.log_comment.default
|
id: comment.log_comment.default
|
|
@ -6,7 +6,7 @@ dependencies:
|
||||||
- field.field.comment.log_comment.comment_body
|
- field.field.comment.log_comment.comment_body
|
||||||
enforced:
|
enforced:
|
||||||
module:
|
module:
|
||||||
- farm_comment
|
- farm_comment_log
|
||||||
module:
|
module:
|
||||||
- text
|
- text
|
||||||
id: comment.log_comment.default
|
id: comment.log_comment.default
|
|
@ -6,7 +6,7 @@ dependencies:
|
||||||
- field.storage.comment.comment_body
|
- field.storage.comment.comment_body
|
||||||
enforced:
|
enforced:
|
||||||
module:
|
module:
|
||||||
- farm_comment
|
- farm_comment_log
|
||||||
module:
|
module:
|
||||||
- text
|
- text
|
||||||
id: comment.log_comment.comment_body
|
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
|
22
modules/core/comment/modules/log/farm_comment_log.module
Normal file
22
modules/core/comment/modules/log/farm_comment_log.module
Normal file
|
@ -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 a new issue