Add hook_convert_bundle_alter() to alter entity during convert

Created on 16 February 2023, almost 2 years ago
Updated 28 April 2023, over 1 year ago

Problem/Motivation

When converting bundles of taxonomy term entities they are ordered alphabetically into target bundle. This makes it hard to sort an amount of converted taxonomy term entities in a possible wanted hierarchical structure in target bundle.

I've tested around a little bit and I think solution with a hook_convert_bundle_alter() which is fired before converted entity is saved is the best way to handle such custom needed features during converting bundles.

Example:

You want to migrate one/all taxonomy terms of the ingame vocabulary into the event vocabulary, but all taxonomy terms from ingame vocabulary should be organized under the ingame taxonomy term entity in the event vocabulary.

Steps to reproduce

Proposed resolution

Other possible solution would be to provide a hook_convert_bundle_alter(ContentEntityInterface $old_enttity, ContentEntityInterface $new_entity) where we could do our custom needed stuff before converted entity gets saved.

Remaining tasks

User interface changes

API changes

Add hook_convert_bundle_alter(ContentEntityInterface $old_enttity, ContentEntityInterface $new_entity) as additional feature to convert_bundles.api.php file.

Data model changes

✨ Feature request
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡©πŸ‡ͺGermany IT-Cru Munich

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024