Hi and thank you for this great module!

Some configuration entities offer a "duplicate" link in their action dropdown, like for example views. This would also help a lot for pathauto patterns. We're having many cases where the patterns are nearly the same (but differ in path a bit) for multilang sites.
A copy functionality would save a lot of time.

I created a fake screen for that:
Pathauto pattern clone action

That "duplicate" action should prepopulate a new entry with the values from the "cloned" one. Perhaps there is already a general solution for something like that in ctools or other modules like views?

I'd like to get some feedback. And perhaps someone has an idea or snippet? Thank you.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Anybody created an issue. See original summary.

Anybody’s picture

Issue summary: View changes
Anybody’s picture

Issue summary: View changes
jefuri’s picture

Added the duplicate option now. The way this patch works is dat the PathautoDuplicateForm extends the PauthautoEditForm. The only difference is that the original entity is duplicated and forced as a new entity, resetting the entity keys. This provides an add form that is prefilled with all the information from the original entity, but saving it is a new entity.

This way you can immediately do your changes like setting the language as well before saving the form.

jefuri’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, 4: duplicate_operation-3000788-4.patch, failed testing. View results

jefuri’s picture

Status: Needs work » Needs review
FileSize
3.99 KB

Somehow provided an empty patch file, my bad. Uploaded the correct one now

Status: Needs review » Needs work

The last submitted patch, 7: duplicate_operation-3000788-6.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

jefuri’s picture

Test failed because the duplicated pattern was used in other tests, added a delete to make sure this is not happening.

jefuri’s picture

Status: Needs work » Needs review
Nitebreed’s picture

Status: Needs review » Reviewed & tested by the community

This looks great!

Anybody’s picture

Great work, thank you for your implementation. RTBC +1

Berdir’s picture

Status: Reviewed & tested by the community » Fixed

Thanks, even has tests, so can't complain. entity.module now has a built-in replicate feature I think, but I'm trying to keep dependencies as small as possible here, hopefully can get rid of ctools at some point..

  • Berdir committed 68ec5f7 on 8.x-1.x authored by jefuri
    Issue #3000788 by jefuri, Anybody: Add "duplicate" action for pathauto...
Anybody’s picture

Thanks, that's a great helper! :)

Status: Fixed » Closed (fixed)

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