If you enable the module and try to Clone the content by clicking on the Clone button while you are on the View mode of the page, the page simply redirects to the same node's content type creation link i.e. node/add/content_type and not to the cloning of the same node. BUT, if you are on the edit mode of the node and then click on Clone button than it works as expected.
1. Download & enable the module
2. Try to Clone the node from the view mode of the node, you will notice that it takes you to the same node's content type's node creation page.
3. Now go to a node and edit it and then try to clone the node, it works as expected.
In the .module file if you visit the function
content_entity_clone_menu_local_tasks_alter
, you will notice at the bottom of that function there is this piece of code
$data['tabs'][0]['content_entity_clone.clone'] = [
'#theme' => 'menu_local_task',
'#link' => [
'title' => 'clonging'?? t('Clone'),
'url' => Url::fromRoute($entity_creation_route_name, $entity_creation_route_parameters),
'localized_options' => [
'query' => [
'content_entity_clone' => $entity->id(),
],
],
],
'#access' => $access,
];
The localized_options query parameter doesn't fire on node view. We need to fix that.
Active
1.0
Code