Closed (fixed)
Project:
Content Entity Clone
Version:
1.0.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
25 Aug 2023 at 11:39 UTC
Updated:
29 Apr 2024 at 08:04 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
dieppon commentedHi,
I have added a hook_entity_operation() using the code from the hook_menu_local_tasks_alter() it will be need so love but it works.
Comment #5
orakili commentedMR based on patch from @dieppon: https://git.drupalcode.org/project/content_entity_clone/-/merge_requests/6 with some refactoring to reduce duplicate code.
Note: this will be adjusted to handle translation when tackling https://www.drupal.org/project/content_entity_clone/issues/3423495.
Comment #7
vaish commentedI was about to create new issue when I noticed that it was already fixed in this MR so I decided to add an additional related fix here instead of creating new issue. These are the issues I'm referring to:
1. Query string is missing when "Clone" local task is displayed in the admin toolbar. This requires that admin_toolbar_tools module is enabled and "Enable/Disable local tasks display" setting is turned on. This has been fixed in this MR by adding the third parameter
$optionsto theUrl::fromRoute()call.2. I also run into the issue #3397570: Undefined array key "#active" in Drupal\admin_toolbar_tools\AdminToolbarToolsHelper->buildLocalTasksToolbar() . As per the docs local task is expected to have "#active" key but in this case key was not defined. Unfortunately, I had trouble reproducing this issue. I'm getting it on a project with many contrib and custom modules but not on the clean Drupal install. I still think it makes sense to define this key. Value will always be FALSE because it's impossible for "Clone" tab to ever be active.
3. I also fixed some minor typos.
Additionally, I noticed that this MR also fixes #3397611: Where is the link to create a clone from node?. Marking that other issue as duplicate.
Comment #8
orakili commentedThank you for fixing the typos.
I couldn't reproduce the issue with the `#active` key but I didn't see any adverse effects with it either, so that looks good to me. Thanks.
Comment #9
vaish commentedThanks @orakili. MR looks good to me (both code and functionality) and if you are fine with the changes I made I think this can be moved to RTBC.
Comment #10
gaurav_manerkar commentedLooks good.
Comment #12
orakili commentedComment #13
sir_squall commentedamazing thanks