1

I have a JSON file with an entry that looks like this:

"taxonomy": "abc/historical_controls/abc2000_2013"

In my YML file I have it mapped like this:

  field_abc_asset_taxonomy_auto:
    -
      plugin: skip_on_empty
      method: process
      source: taxonomy
    -
      plugin: explode
      delimiter: /
    -
      plugin: callback
      callable: ltrim
    -
      plugin: callback
      callable: rtrim
    -
      plugin: entity_generate
      value_key: name
      entity_type: taxonomy_term
      bundle_key: vid
      bundle: abc_asset_taxonomy_auto

This works in that it brings over the terms correctly, but in a flat file. I need them to come over so that each term is a child of the term before it so:

abc historical_controls abc2000_2013

The problem is there is an unknown number of items. It could be 2, it could be 10.

Is there a way to migrate hierarchical taxonomy with an unknown number of parent child relationships?

Note, I've seen several examples that use a determinant number of sources but this wouldn't work here. The "Migrate Hierarchical Taxonomy" module uses a determinant number as well. How can I achieve this with the Migrate API preferably without writing a custom plugin?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.