Merge plan_record module into plan module.

This commit is contained in:
Michael Stenta 2024-01-30 08:33:10 -05:00
parent 36fc154c47
commit 8bf87f00fe
8 changed files with 41 additions and 27 deletions

View File

@ -19,6 +19,20 @@ plan.type.*:
type: boolean
label: 'Create new revision'
plan.record.type.*:
type: config_entity
label: 'Plan record relationship type'
mapping:
id:
type: string
label: 'Machine-readable name'
label:
type: label
label: 'Type'
description:
type: text
label: 'Description'
condition.plugin.plan_type:
type: condition.plugin
mapping:

View File

@ -1,13 +0,0 @@
plan_record.type.*:
type: config_entity
label: 'Plan record relationship type'
mapping:
id:
type: string
label: 'Machine-readable name'
label:
type: label
label: 'Type'
description:
type: text
label: 'Description'

View File

@ -1,8 +0,0 @@
name: Plan record relationship
description: Provides an entity to store the relationship between a plan and a record along with additional metadata.
type: module
package: farmOS
core_version_requirement: ^10
dependencies:
- entity:entity
- farm:plan

View File

@ -0,0 +1,18 @@
<?php
/**
* @file
* Post update hooks for the plan module.
*/
/**
* Install plan_record and plan_record_type entity types.
*/
function plan_post_update_install_plan_record(&$sandbox) {
\Drupal::entityDefinitionUpdateManager()->installEntityType(
\Drupal::entityTypeManager()->getDefinition('plan_record_type')
);
\Drupal::entityDefinitionUpdateManager()->installEntityType(
\Drupal::entityTypeManager()->getDefinition('plan_record')
);
}

View File

@ -1,6 +1,6 @@
<?php
namespace Drupal\plan_record\Entity;
namespace Drupal\plan\Entity;
use Drupal\Core\Entity\ContentEntityBase;
use Drupal\Core\Entity\EntityTypeInterface;
@ -9,6 +9,9 @@ use Drupal\Core\Field\BaseFieldDefinition;
/**
* Defines the Plan record relationship entity.
*
* This entity type can be used to create relationships between a plan and other
* record(s) along with additional metadata fields to describe the relationship.
*
* @ContentEntityType(
* id = "plan_record",
* label = @Translation("Plan record relationship"),
@ -38,7 +41,7 @@ class PlanRecord extends ContentEntityBase implements PlanRecordInterface {
* {@inheritdoc}
*/
public function getBundleLabel() {
/** @var \Drupal\plan_record\Entity\PlanRecordTypeInterface $type */
/** @var \Drupal\plan\Entity\PlanRecordTypeInterface $type */
$type = \Drupal::entityTypeManager()
->getStorage('plan_record_type')
->load($this->bundle());

View File

@ -1,6 +1,6 @@
<?php
namespace Drupal\plan_record\Entity;
namespace Drupal\plan\Entity;
use Drupal\Core\Entity\ContentEntityInterface;

View File

@ -1,6 +1,6 @@
<?php
namespace Drupal\plan_record\Entity;
namespace Drupal\plan\Entity;
use Drupal\Core\Config\Entity\ConfigEntityBundleBase;
@ -20,7 +20,7 @@ use Drupal\Core\Config\Entity\ConfigEntityBundleBase;
* handlers = {
* "access" = "\Drupal\entity\BundleEntityAccessControlHandler",
* },
* config_prefix = "type",
* config_prefix = "record.type",
* bundle_of = "plan_record",
* entity_keys = {
* "id" = "id",

View File

@ -1,6 +1,6 @@
<?php
namespace Drupal\plan_record\Entity;
namespace Drupal\plan\Entity;
use Drupal\Core\Config\Entity\ConfigEntityInterface;
use Drupal\Core\Entity\EntityDescriptionInterface;