This is a follow-up to the patch I created for Migrate d2d: https://www.drupal.org/project/migrate_d2d/issues/3002973 β¨ Support forum taxonomy terms Needs review I believe both patches are necessary.
Let me start by saying I am open to taking a different approach, but the patches I have created do work.
The fundamental issue is MigratePathEntityHandler
makes the assumption that all taxonomy terms are the same. However, this is not the case.
The Forum module included in core bypasses what the Taxonomy module does, and creates a path of forum/tid
for terms that are part of the "forums" vocabulary, rather than taxonomy/term/tid
. In fact, forums terms *never* have a path of taxonomy/term/tid
stored in the url_alias
table.
The conflict with the Migrate module is how it handles creation of paths. The import
function in MigrateDestinationTerm
relies on taxonomy_term_save
, as I would expect. The Migrate module also expects a value for $path
to exist, otherwise a path will not be created.
However, having a $path
value set causes the path_taxonomy_term_insert
function to run, and a taxonomy/term/tid
path is created. On the other side, the value of $term->path
is not set when creating a forums term, and therefore the creation of a taxonomy/term/tid
path is properly skipped.
So I'm not sure the best way to handle this... Migrate needs a $path
to generate paths, but Forum taxonomy terms cannot have $path
set, or else two entries are made to the url_alias
table (one for taxonomy/term/tid
and a second for forum/tid
.
The best solution I could come up with at the moment is to perform a check in the complete
function, and delete the taxonomy/term/tid
path when a forum term is created.
I'd appreciate any feedback and review on the attached patch. Thanks.
Fixed
2.0
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
No activities found.