Add support for media and taxonomy term merging

Created on 24 February 2022, about 3 years ago
Updated 22 February 2023, about 2 years ago

At the moment this module only supports the merging of nodes. We needed to merge terms and media items as well, so we patched the module. We'll add our changes to the project.

Feature request
Status

Needs work

Version

1.0

Component

Code

Created by

🇧🇪Belgium tijsdeboeck Antwerp 🇧🇪 🇪🇺 🌎

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

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • miiimooo Europe

    Tested this with a media entity (Media source: File, the file is stored in a simple File field type):

    1. The name/label of the merged entity got overwritten with the file name (my media entity type is configured with a field mapping Name -> Name; maybe that's causing this?)
    2. The label on the media "Merge translations" form says "Remove term" instead of "Remove media"
    3. Loading the merge form I get
      reset(): Calling reset() on an object is deprecated in Drupal\merge_translations\Form\MergeTranslationsForm->__construct() (line 113 of /app/web/modules/contrib/merge_translations/src/Form/MergeTranslationsForm.php).:"
  • Merge request !5Resolve #3266357 "Media and term merging" → (Open) created by miiimooo
  • Status changed to Needs review over 1 year ago
  • miiimooo Europe

    Fixed the "reset" warning and created a new MR

  • 🇨🇴Colombia sebasgd

    sebasgd changed the visibility of the branch 3266357-media-and-term-merging to hidden.

  • 🇨🇴Colombia sebasgd

    sebasgd changed the visibility of the branch 3266357-media-and-term-merging to active.

  • 🇨🇴Colombia sebasgd

    I've tested this patch and it seems to work. I only found minor thing and is that when you try to merge media, the option to remove the source item says "Remove term" instead of "Remove media".

  • Status changed to Needs work 8 months ago
  • 🇫🇮Finland sokru

    Otherwise looks good, but the issue reported by @sebasgd on #14 needs to be resolved.
    Maybe increasing the test coverage for this wouldn't hurt, for that I'd recommend merging 📌 Set up Gitlab CI Fixed first.

  • 🇵🇱Poland lamp5 Rzeszow

    📌 Set up Gitlab CI Fixed merged, If you have a free time, you can go ahead with this task.

  • 🇫🇮Finland sokru

    sokru changed the visibility of the branch 3266357-remove-entity-doesnt to hidden.

  • 🇫🇮Finland sokru

    sokru changed the visibility of the branch 8.x-1.x to hidden.

  • Pipeline finished with Success
    8 months ago
    Total: 159s
    #249860
  • Pipeline finished with Success
    8 months ago
    Total: 139s
    #250742
  • Status changed to Needs review 8 months ago
  • 🇫🇮Finland sokru

    Resolved the issue mentioned on #14 by changing the option to more generic.
    I also refactored the tests to include test for actual merging.
    Leaving up to maintainers if they wish tests also for media entities. IMHO it feels a bit of repetition (and maintenance burden) to include also tests for media entities.

  • Pipeline finished with Success
    8 months ago
    Total: 195s
    #250753
  • Pipeline finished with Failed
    8 months ago
    #250756
  • Pipeline finished with Failed
    8 months ago
    #250757
  • Pipeline finished with Success
    8 months ago
    Total: 5542s
    #250758
  • 🇺🇸United States banoodle San Francisco, CA

    Patch #5 no longer applies on the latest 2.0.x-dev branch.

    Attaching re-rolled patch.

    Thanks!

  • miiimooo Europe

    If you need to patch 2.0.0 here is the old patch that still applies correctly

  • Status changed to Needs work about 18 hours ago
  • miiimooo Europe

    * Tested with media entity and works
    * Tested with taxonomy term entity and failed:

    Drupal\Core\Entity\Query\QueryException: 'created' not found in Drupal\Core\Entity\Query\Sql\Tables->ensureEntityTable() (line 369 of /app/web/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php).
    
    #0 /app/web/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php(263): Drupal\Core\Entity\Query\Sql\Tables->ensureEntityTable('', 'created', 'LEFT', NULL, 'base_table', 'tid', Array)
    #1 /app/web/core/lib/Drupal/Core/Entity/Query/Sql/Query.php(296): Drupal\Core\Entity\Query\Sql\Tables->addField('created', 'LEFT', NULL)
    #2 /app/web/core/lib/Drupal/Core/Entity/Query/Sql/Query.php(197): Drupal\Core\Entity\Query\Sql\Query->getSqlField('created', NULL)
    #3 /app/web/core/lib/Drupal/Core/Entity/Query/Sql/Query.php(83): Drupal\Core\Entity\Query\Sql\Query->addSort()
    #4 /app/web/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/DefaultSelection.php(364): Drupal\Core\Entity\Query\Sql\Query->execute()
    #5 /app/web/core/lib/Drupal/Core/Entity/EntityAutocompleteMatcher.php(47): Drupal\Core\Entity\Plugin\EntityReferenceSelection\DefaultSelection->getReferenceableEntities('term', 'CONTAINS', 10)
    #6 /app/web/core/modules/system/src/Controller/EntityAutocompleteController.php(117): Drupal\Core\Entity\EntityAutocompleteMatcher->getMatches('taxonomy_term', 'hrw_unpublished...', Array, 'term')
    #7 [internal function]: Drupal\system\Controller\EntityAutocompleteController->handleAutocomplete(Object(Symfony\Component\HttpFoundation\Request), 'taxonomy_term', 'hrw_unpublished...', 'H2ypDlTHW-MujMx...')
    #8 /app/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
    #9 /app/web/core/lib/Drupal/Core/Render/Renderer.php(638): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
    #10 /app/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(121): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
    #11 /app/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
    #12 /app/vendor/symfony/http-kernel/HttpKernel.php(181): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
    #13 /app/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
    #14 /app/web/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #15 /app/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #16 /app/web/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #17 /app/vendor/asm89/stack-cors/src/Cors.php(53): Drupal\Core\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #18 /app/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Asm89\Stack\Cors->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #19 /app/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #20 /app/web/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #21 /app/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #22 /app/web/core/lib/Drupal/Core/DrupalKernel.php(741): Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #23 /app/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
    #24 {main}
    


    Location: .../entity_reference_autocomplete/taxonomy_term/hrw_unpublished_term/H2ypDlTHW-MujMxTgcs_kHX-DkfySQNMvpmbeokNHr0?q=term

Production build 0.71.5 2024