This way, they can be found by the look up operation. Parent terms should be migrated before their children. The difference is that, in this case, the migration to reference is the same one being defined. To assign its value, the ` migration_lookup` plugin is configured similar to the previous example. It stores the taxonomy term id (`tid`) of the parent term. In the case of `parent`, it is an entity reference to another taxonomy term. The first two are strings copied directly from the source. The following snippet shows how the destination section is configured: destination:įor the process section, three entity properties are set: name, description, and parent. If you write to a single one, the `default_bundle` key in the destination can be used instead. If you have terms that would be stored in different vocabularies, you can use the `vid` property in the process section to assign the target vocabulary. Additionally, you indicate which vocabulary to migrate into. The target entity is set to taxonomy terms. The following snippet shows how the source section is configured: source:įruit_description: 'Eat fresh or prepare some jelly.'įruit_description: 'Eat fresh or prepare a jam.' If term names could change over time, it is recommended to have another column that did not change (e.g., an autoincrementing number). ![]() Instead, the value of the `name` is used as a `string` identifier for the migration. Note that no numerical identifier is provided. ![]() For example, “Red grape” is a child of “Grape”. Additionally, it is possible to define a parent term to establish hierarchy. Each row will contain the name and description of the fruit. The example data for the taxonomy terms migration is fruits and fruit varieties. Migrating taxonomy terms and their hierarchy The words in parenthesis represent the machine name of each element. Particularly, a Tags (`tags`) taxonomy vocabulary, an Article (`article`) content type, and a Tags (`field_tags`) field that accepts multiple values. The example assumes Drupal was installed using the `standard` installation profile. Refer to this article to learn where the module should be placed. Notice that both migrations belong to the same module. ![]() The two migrations to execute are `udm_dependencies_multivalue_term` and `udm_dependencies_multivalue_node`. You can get the full code example at The module to enable is `UD multivalue taxonomy terms` whose machine name is `ud_migrations_multivalue_terms`. Following this approach, any node and taxonomy term created by the migration process will be removed from the system upon rollback. And another to import into a multivalue taxonomy term field. One to import taxonomy terms accounting for term hierarchy. The example consists of two separate migrations. Along the way, we will present the process and syntax for migrating into multivalue fields. Today we continue the conversation about migration dependencies with a hierarchical taxonomy terms example.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |