I'm pretty new to Drupal and PHP in general, so this may be obvious - But I'm working on with Drupal 7 with Node Clone installed as well as the Webform module. Recently, the "clone" link stopped appearing in the Operations column (had been there at some point) on the Content list page in the admin. The only place it is showing up now is for the individual form fields inside a Webform node. I'm needing to clone whole pages & webforms - not just the form fields.

Was thinking it was a permissions issue? But I'm logged in as administrator with all permissions on. Any help would be appreciated!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Jānis Bebrītis’s picture

replace "MENU_LOCAL_ACTION" with "MENU_LOCAL_TASK" in clone.module line 50

dgreve’s picture

Thanks Jancis! Looks like that added a clone tab within the edit page of each basic page node of the site (unless that was always there?), which is great - But still no "clone" link or tab showing up for any of the webform nodes. I add a new form to the site every few weeks using webform and will really stink having to recreate them everytime.

Let me know if there's any other info that might be helpful. Thanks!

Todd Young’s picture

I followed #1 (line to edit was #51) to no avail. But like #2 I then saw the clone link for the first time in the view of the node - not even the edit? But still nothing in the operations area, if that was what was intended...

temosayin’s picture

Version: 7.x-1.0-beta1 » 7.x-1.x-dev
FileSize
461 bytes

Heres a patch to show a clone-link in the operation area

Fabianx’s picture

Category: support » feature
Status: Active » Needs review
Issue tags: +patch
moshe weitzman’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -patch +Release blocker
RobLoach’s picture

FileSize
599 bytes

The patch wasn't applying before. So I updated it, and touched it up a bit.

ngottlieb’s picture

I am still not seeing the link after applying the first patch (second one returned an error). Anyone know of another solution out there?

Refineo’s picture

Sorry, should this be "RTBC" or "needs work" now ?

johnv’s picture

Status: Reviewed & tested by the community » Needs work

@refineo, if a patch is not working, status is 'needs work'.

After applying #7, the link shows up in /admin/content/node, however:
- title is better off with no Capital : 'title' => t('Cclone'),
- The link is shown even for nodes of types that cannot be cloned (the link ands in a Access denied page)

johnv’s picture

Title: "Clone" link not showing up in operations column » No "Clone" link in operations column of Content page
Status: Needs work » Needs review
FileSize
754 bytes

Attached patch includes comments of #10

pwolanin’s picture

minor - but // issue 1161924, add clone-link to page admin/content/node code comment it out of place in the patch and should be removed.

johnv’s picture

a cleaner patch is attached.

pwolanin’s picture

Status: Needs review » Needs work

ok, so there is a variable in there called $node, that should probably be $operations when looking at the base form

Also, you might want to just get all the nids and do:

 $nodes = node_load_multiple($nids);

http://api.drupal.org/api/drupal/modules%21node%21node.admin.inc/functio...

johnv’s picture

Status: Needs work » Needs review

I don't understand your first comment.
As for the second one: all nodes have been loaded in cache in an earlier stage, so fetching the nodes one-by-one has no impact on database-load.

pwolanin’s picture

maybe I'm misunderstanding the form structure.

+  foreach($form['admin']['nodes']['#options'] as $nid => &$node){

is the thing you are iterating actually a node, or just a form element?

johnv’s picture

The foreach loops over the item list, which contains arrays. Then I set the list of operations.
The item list only contains nid as a useable variable. Node->type is not avaiable, but necessary for the access check. There for I must use node_load(), and cannot use the method you use in Views-integration (creating a new StdClass).

Any way, I didn't make it up myself, but copied from some place.
I'd say, just try it out!

dannygrimes’s picture

Last patch worked for me. Clone shows up in the content listing. Thanks to poster and dev.

michaelfavia’s picture

FileSize
331 bytes

The attached patch restores Clone to the local menu tabs next to view and edit. I realize this goes against current trends to move to actions for actionable elements but it is what our client wanted and most tend to. Incase anyone else needs it.

Don't forget to clear your cache after applying it.

johnv’s picture

@michaelfavia, I think you have mixed up the issues. Your patch is already supplied in #1328682-2: Add a link to the contextual menu / or a tab for cloning the node

pwolanin’s picture

FileSize
682 bytes

Changed the variables to have more correct naming.

sdragnev’s picture

Version: 7.x-1.x-dev » 7.x-1.0-beta1
FileSize
617 bytes

This patch work for 1.0-beta1 for me.

pwolanin’s picture

Version: 7.x-1.0-beta1 » 7.x-1.x-dev

Maybe needs a destination param for consistency with other links on that page?

pwolanin’s picture

Status: Needs review » Fixed

Committed w/ destination added.

pwolanin’s picture

FileSize
761 bytes

oops - forgot the final patch

jajouka’s picture

it seems like the alterations in 1161924-23.patch have been included in the latest stable and dev releases. I am still not seeing the clone link using either of these version, thanks

pwolanin’s picture

They show for me - be sure to run update.php or a cache clear so that new hook implementations are discovered.

zerbash’s picture

Category: feature » bug

I can see the clone link in the operations column as admin, but not as a user. The problem seems to lie in the $form['admin']['nodes'] array processed in clone_form_node_admin_content_alter(). As admin, the array has the ['#options'] element. As a user, this element is called ['#rows'].

If you change line 150 of clone.module
foreach($form['admin']['nodes']['#options'] as $nid => &$row){
to
foreach($form['admin']['nodes']['#rows'] as $nid => &$row){
the clone link will show up for users (will appropriate permissions), but no longer for admin.

pwolanin’s picture

Status: Fixed » Active

ugh, well that's pretty stupid core code. The target of this is more for admins, but it would be nice to expose it for users too.

nfriend’s picture

I'm just taking a look at "Clone" for the first time in D7 - have it working in D6 without any problems.

I too see the "clone" option as Admin in the operations column. But I do not see the Tab next to View|Edit when viewing the node - not as Admin or as a role with clone permissions set.

Are all patches in the Aug 5 release? I did not try the Dev release as they look to be the same date.

Neil

nairb’s picture

The clone link was removed from the Tabs and is now in Actions. See 1328682 for more info. If you are using a theme you ported from D6, you may be missing the $action_links variable as I was. Try switching to Garland and you should see a clone content link.

nfriend’s picture

Thanks for the tip @nairb -I really liked it on the tab area - only users with editing access typically have need for this feature and the small distraction an extra tab brings seems harmless.

I actually need it in a premium D7 theme and it does not show action links?!

However Views has an option (undocumented?) to include the Clone Link which works great!

My thanks to all contributors.

Neil

ParisLiakos’s picture

Status: Active » Fixed

Well lets move the discussion on the bug here:
#1762106: Invalid arguments supplied for foreach() there is a patch there

Taxoman’s picture

FWIW, I also think that the Node Clone action should be (optionally) visible as a _tab_, even if also found under actions.

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

knalstaaf’s picture

Issue summary: View changes
Status: Closed (fixed) » Needs review

The patch in #25 gives me this:

Fatal error: Cannot redeclare clone_form_node_admin_content_alter() (previously declared in /home/usr1/domain/public_html/sites/all/modules/node_clone/clone.module:165) in /home/usr1/domain/public_html/sites/all/modules/node_clone/clone.module on line 201

Update.php gives me a WSOD.
Impossible to clear cache (no access to Drush).
No tab in node form either.

  • Commit 5eb38ff on 7.x-1.x, 8.x-1.x by pwolanin:
    Issue #1161924 by johnv, pwolanin: Add a clone link in operations column...
pwolanin’s picture

Status: Fixed » Closed (fixed)

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