From b88877b61706ded3590f71b23bac48041c9470ac Mon Sep 17 00:00:00 2001 From: s33a Date: Thu, 29 Jul 2021 10:28:30 -0400 Subject: [PATCH] Rename "Material" taxonomy to "Material types". This also changes the `material` term reference field on Input logs to `material_type`, and updates all migrations accordingly. --- docs/development/api/changes.md | 2 +- docs/model/type/log.md | 2 +- docs/model/type/term.md | 2 +- .../migrate_plus.migration.farm_migrate_log_input.yml | 6 +++--- ....migration.farm_migrate_taxonomy_material_type.yml} | 10 +++++----- modules/log/input/farm_input.info.yml | 2 +- modules/log/input/src/Plugin/Log/LogType/Input.php | 10 +++++----- .../config/install/taxonomy.vocabulary.material.yml | 10 ---------- .../install/taxonomy.vocabulary.material_type.yml | 10 ++++++++++ .../farm_material_type.info.yml} | 4 ++-- 10 files changed, 29 insertions(+), 29 deletions(-) rename modules/core/migrate/config/optional/{migrate_plus.migration.farm_migrate_taxonomy_material.yml => migrate_plus.migration.farm_migrate_taxonomy_material_type.yml} (80%) delete mode 100644 modules/taxonomy/material/config/install/taxonomy.vocabulary.material.yml create mode 100644 modules/taxonomy/material_type/config/install/taxonomy.vocabulary.material_type.yml rename modules/taxonomy/{material/farm_material.info.yml => material_type/farm_material_type.info.yml} (55%) diff --git a/docs/development/api/changes.md b/docs/development/api/changes.md index efe1553a..95b89779 100644 --- a/docs/development/api/changes.md +++ b/docs/development/api/changes.md @@ -324,7 +324,7 @@ vocabularies of terms. The vocabulary machine names have changed, to drop the - `farm_animal_types` -> `animal_type` - `farm_areas` has been removed (see "Areas" below) - `farm_log_categories` -> `log_category` -- `farm_materials` -> `material` +- `farm_materials` -> `material_type` - `farm_season` -> `season` - `farm_crops` -> `plant_type` - `farm_crop_families` -> `crop_family` diff --git a/docs/model/type/log.md b/docs/model/type/log.md index c9581fcd..1004ba94 100644 --- a/docs/model/type/log.md +++ b/docs/model/type/log.md @@ -269,7 +269,7 @@ Input Logs have the following additional attributes: And the following additional relationships: -- Material (References Terms in the "Material" vocabulary) +- Material type (References Terms in the "Material types" vocabulary) #### Lab Test Logs diff --git a/docs/model/type/term.md b/docs/model/type/term.md index 1639cbde..4a1b4b8e 100644 --- a/docs/model/type/term.md +++ b/docs/model/type/term.md @@ -18,7 +18,7 @@ is enabled. The modules included with farmOS define the following vocabularies: - Animal type - Log category -- Material +- Material type - Plant type - Season - Unit diff --git a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_log_input.yml b/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_log_input.yml index 80c699ad..7b9af15e 100644 --- a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_log_input.yml +++ b/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_log_input.yml @@ -32,13 +32,13 @@ process: lot_number: plugin: get source: field_farm_lot_number - material: + material_type: plugin: sub_process source: field_farm_material process: target_id: plugin: migration_lookup - migration: farm_migrate_taxonomy_material + migration: farm_migrate_taxonomy_material_type source: tid method: plugin: get @@ -51,5 +51,5 @@ process: source: field_farm_input_source migration_dependencies: required: - - farm_migrate_taxonomy_material + - farm_migrate_taxonomy_material_type optional: { } diff --git a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_taxonomy_material.yml b/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_taxonomy_material_type.yml similarity index 80% rename from modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_taxonomy_material.yml rename to modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_taxonomy_material_type.yml index 2c5cb374..ea88a8be 100644 --- a/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_taxonomy_material.yml +++ b/modules/core/migrate/config/optional/migrate_plus.migration.farm_migrate_taxonomy_material_type.yml @@ -3,10 +3,10 @@ status: true dependencies: enforced: module: - - farm_material + - farm_material_type - farm_migrate -id: farm_migrate_taxonomy_material -label: 'Taxonomy terms (Materials)' +id: farm_migrate_taxonomy_material_type +label: 'Taxonomy terms (Material types)' migration_group: farm_migrate_taxonomy migration_tags: - 'Drupal 7' @@ -23,7 +23,7 @@ process: # Hard-code the vocabulary. vid: plugin: default_value - default_value: material + default_value: material_type # Maintain the term ID. tid: plugin: get @@ -36,7 +36,7 @@ process: source: parent - plugin: migration_lookup - migration: farm_migrate_taxonomy_material + migration: farm_migrate_taxonomy_material_type parent: plugin: default_value default_value: 0 diff --git a/modules/log/input/farm_input.info.yml b/modules/log/input/farm_input.info.yml index 49b1d68a..cc9c19d8 100644 --- a/modules/log/input/farm_input.info.yml +++ b/modules/log/input/farm_input.info.yml @@ -5,4 +5,4 @@ package: farmOS Logs core_version_requirement: ^9 dependencies: - farm:farm_entity - - farm:farm_material + - farm:farm_material_type diff --git a/modules/log/input/src/Plugin/Log/LogType/Input.php b/modules/log/input/src/Plugin/Log/LogType/Input.php index ebc8a5fa..1a14c561 100644 --- a/modules/log/input/src/Plugin/Log/LogType/Input.php +++ b/modules/log/input/src/Plugin/Log/LogType/Input.php @@ -32,13 +32,13 @@ class Input extends FarmLogType { ]; $fields['lot_number'] = $this->farmFieldFactory->bundleFieldDefinition($options); - // Material. + // Material type. $options = [ 'type' => 'entity_reference', - 'label' => $this->t('Material'), - 'description' => $this->t('What materials are being applied?'), + 'label' => $this->t('Material type'), + 'description' => $this->t('What type of materials are being applied?'), 'target_type' => 'taxonomy_term', - 'target_bundle' => 'material', + 'target_bundle' => 'material_type', 'auto_create' => TRUE, 'multiple' => TRUE, 'weight' => [ @@ -46,7 +46,7 @@ class Input extends FarmLogType { 'view' => -50, ], ]; - $fields['material'] = $this->farmFieldFactory->bundleFieldDefinition($options); + $fields['material_type'] = $this->farmFieldFactory->bundleFieldDefinition($options); // Method. $options = [ diff --git a/modules/taxonomy/material/config/install/taxonomy.vocabulary.material.yml b/modules/taxonomy/material/config/install/taxonomy.vocabulary.material.yml deleted file mode 100644 index 9559d4e3..00000000 --- a/modules/taxonomy/material/config/install/taxonomy.vocabulary.material.yml +++ /dev/null @@ -1,10 +0,0 @@ -langcode: en -status: true -dependencies: - enforced: - module: - - farm_material -name: Materials -vid: material -description: 'A list of materials.' -weight: 0 diff --git a/modules/taxonomy/material_type/config/install/taxonomy.vocabulary.material_type.yml b/modules/taxonomy/material_type/config/install/taxonomy.vocabulary.material_type.yml new file mode 100644 index 00000000..a5d9b930 --- /dev/null +++ b/modules/taxonomy/material_type/config/install/taxonomy.vocabulary.material_type.yml @@ -0,0 +1,10 @@ +langcode: en +status: true +dependencies: + enforced: + module: + - farm_material_type +name: Material types +vid: material_type +description: 'A list of material types.' +weight: 0 diff --git a/modules/taxonomy/material/farm_material.info.yml b/modules/taxonomy/material_type/farm_material_type.info.yml similarity index 55% rename from modules/taxonomy/material/farm_material.info.yml rename to modules/taxonomy/material_type/farm_material_type.info.yml index e0af077c..d1a64332 100644 --- a/modules/taxonomy/material/farm_material.info.yml +++ b/modules/taxonomy/material_type/farm_material_type.info.yml @@ -1,5 +1,5 @@ -name: Materials vocabulary -description: Provides a Materials vocabulary. +name: Material types vocabulary +description: Provides a Material types vocabulary. type: module package: farmOS Taxonomies core_version_requirement: ^9