我有一个有几个不同节点类型的网站。其中有些类型在其中使用文本(列表)字段创建。
例如:
节点内容类型:化学品
标签:化学类型机器名称: field_chemical_type字段类型:列表(文本)
允许值列表:
无价无机肥料
无性杀菌剂
商品化高效除草剂除草剂
易感性非顺式杀虫剂
准中性中性表面活性剂/表面活性剂
指标/指标/指标
我们希望将它们转换为一个新的ECK内容类型,为每个允许的值提供单独的包。其中,我们已经创建了它们,包类型对应于允许值列表中的“键”值。
是否有一种方法可以迁移整个内容类型,并根据field_chemical_type列表中指定的值更改包?
我试过以下几种方法,但这对我没有用:
langcode: en
status: true
dependencies: { }
id: seward7_chemical_nodes
class: Drupal\node\Plugin\migrate\D7NodeTranslation
field_plugin_method: null
cck_plugin_method: null
migration_tags:
- 'Drupal 7'
- Content
migration_group: sew7
label: 'Chemical Nodes'
source:
plugin: d7_node
node_type: chemicals
process:
id:
-
plugin: get
source: nid
type:
-
plugin: get
source: field_chemical_type
langcode:
-
plugin: default_value
source: language
default_value: und
title:
-
plugin: get
source: title
created:
-
plugin: get
source: created
changed:
-
plugin: get
source: timestamp
field_name:
-
plugin: get
source: field_chemical_name
destination:
plugin: 'entity:chemical'
migration_dependencies:
required:
- seward7users
optional: []我在目的地读过与"default_bundle“相矛盾的信息。所以我很困惑。有一篇文章说你必须指定一个default_bundle,如果你在流程端的“类型”中规定了它,那么另一种状态就没有了。
如果我可以在这个过程中指定它,我是否使用了错误的插件?
我们还有其他几种节点内容类型,我们希望将它们转换为具有单独捆绑包的自己实体。因此,不必为单个实体类型中的每个包创建单独的yml文件是非常有益的。
我是一个网站建设者与足够的编码经验,使自己陷入麻烦。但我想学习。任何关于去哪里学习的建议或指导都将不胜感激!
发布于 2023-01-31 15:07:12
我用我的想法更新了我的开发数据库,只更新了我需要的表。在这样做的过程中,我忽略了数据库中的field_config表。所以我想要提到的那个领域没有被人看到。这就给我带来了几天的挫折!
@MikeLutzUS也帮助我解决了问题,因为我需要使用field_chemical_type/0/value作为类型源。以下几点对我有用:
langcode: en
status: true
dependencies: { }
id: seward7_chemical_nodes
class: Drupal\node\Plugin\migrate\D7NodeTranslation
field_plugin_method: null
cck_plugin_method: null
migration_tags:
- 'Drupal 7'
- Content
migration_group: sew7
label: 'Chemical Nodes'
source:
plugin: d7_node
node_type: chemicals
process:
id:
-
plugin: get
source: nid
type:
-
plugin: get
source: field_chemical_type/0/value
langcode:
-
plugin: default_value
source: language
default_value: und
title:
-
plugin: get
source: title
created:
-
plugin: get
source: created
changed:
-
plugin: get
source: timestamp
field_name:
-
plugin: get
source: field_chemical_name
destination:
plugin: 'entity:chemical'
migration_dependencies:
required:
- seward7users
optional: []大喊谢谢!@MikeLutzUS你可以在这里上看到我们的对话
https://drupal.stackexchange.com/questions/314550
复制相似问题