change chemical to be taxonomy term

This commit is contained in:
2024-12-10 23:07:44 +01:00
parent acf0c530ee
commit 9227f828d6
3 changed files with 4 additions and 38 deletions

View File

@@ -1,12 +0,0 @@
langcode: en
status: true
dependencies:
enforced:
module:
- farm_agrikern
id: chemical
label: Chemical
description: 'Chemical Asset'
name_pattern: 'Chemical asset [asset:id]'
workflow: asset_default
new_revision: true

View File

@@ -1,23 +0,0 @@
<?php
namespace Drupal\farm_agrikern\Plugin\Asset\AssetType;
use Drupal\farm_entity\Plugin\Asset\AssetType\FarmAssetType;
/**
* Provides the chemical asset type.
*
* @AssetType(
* id = "chemical",
* label = @Translation("Chemical"),
* )
*/
class Chemical extends FarmAssetType {
/**
* {@inheritdoc}
*/
public function buildFieldDefinitions() {
$fields = parent::buildFieldDefinitions();
return $fields;
}
}

View File

@@ -22,11 +22,12 @@ class Ingredient extends FarmAssetType {
'chemical_field' => [ 'chemical_field' => [
'type' => 'entity_reference', 'type' => 'entity_reference',
'label' => $this->t('Chemical'), 'label' => $this->t('Chemical'),
'description' => $this->t('What chemical does the ingredient track?'), 'description' => $this->t("What chemical does the ingredient track?"),
'target_type' => 'asset', 'target_type' => 'taxonomy_term',
'target_bundle' => 'chemical', 'target_bundle' => 'chemical',
'multiple' => FALSE, 'auto_create' => FALSE,
'required' => TRUE, 'required' => TRUE,
'multiple' => FALSE,
], ],
'amount_field' => [ 'amount_field' => [
'type' => 'fraction', 'type' => 'fraction',