Hi,

The module is working pretty well, not like the other entity clone module, I just have one small request, could you please add the clone link in the admin/content operations? Where we have edit/delete by default, it could be nice to add also the clone there.

Thanks

CommentFileSizeAuthor
#2 add-operation-link-3383353-1.patch2.75 KBdieppon
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

sir_squall created an issue. See original summary.

dieppon’s picture

StatusFileSize
new2.75 KB

Hi,

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.

orakili made their first commit to this issue’s fork.

orakili’s picture

Assigned: Unassigned » orakili
Category: Bug report » Feature request
Status: Active » Needs review

MR 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.

vaish made their first commit to this issue’s fork.

vaish’s picture

I 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 $options to the Url::fromRoute() call.

  $options = [
    'query' => [
      'content_entity_clone' => $entity->id(),
    ],
  ];
  $url = Url::fromRoute($entity_creation_route_name, $entity_creation_route_parameters, $options);

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.

orakili’s picture

Thank 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.

vaish’s picture

Status: Needs review » Reviewed & tested by the community

Thanks @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.

gaurav_manerkar’s picture

Looks good.

  • orakili committed 5d818388 on 1.0.x
    Issue #3383353 by dieppon, orakili, sir_squall, vaish: Add operation...
orakili’s picture

Status: Reviewed & tested by the community » Fixed
sir_squall’s picture

amazing thanks

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.