This is exactly as it sounds. The use case is when the PDF or settings (save-to-file vs. download, etc.) will be different, but the mappings will be much the same, and the old PDF should still exist separately and be usable.

I was thinking of enhancing export/import initially, but the fact that those only act on mappings is actually ideal (I use that when updating the PDF as well), so I'm going to leave them alone.

Comments

wizonesolutions’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev
Priority: Minor » Major
Issue tags: +fillpdf2

Definitely want this in 7.x-2.x. I'm not sure if this will be affected by #1526496: Separate out PDF templates from mapping configurations, but I could handle that when the time came.

liam morland’s picture

Version: 7.x-2.x-dev » 8.x-4.x-dev
Issue summary: View changes
liam morland’s picture

Issue tags: -fillpdf2
pancho’s picture

Status: Active » Postponed
Issue tags: +Usability
pancho’s picture

Status: Postponed » Active

No longer postponed.

pancho’s picture

Title: Add Clone option to form configurations » Add Duplicate option to form configurations
Status: Active » Needs review
Issue tags: +Needs tests
StatusFileSize
new4.44 KB

Here's an initial patch which allows duplicating an existing FillPdfForm together with all its FillPdfFormFields and a reference to the very same template File entity. Only the admin_title gets a "Duplicate of" prepended, otherwise it's a 1:1 copy with all settings and field mappings.

Still some tests needed, otherwise this already seems to work flawlessly... :)

In a followup, we might want to move parts of the logic for creating a brandnew FillPdfForm, which is currently buried within FillPdfOverviewForm::submit() and InputHelper, to the new FillPdfFormController as well, but that's out of scope here.

Alternatively, we could turn the controller into a confirmation form and ask for the new admin_title. This way we would mirror Views UI duplicate functionality. One or the other is fine and not too much work. So we can just do what is considered a tad better Usability-wise. For that I'd need some input.

liam morland’s picture

It makes sense to me to mirror what Views is doing.

pancho’s picture

StatusFileSize
new6.9 KB

Fine, so here's a version that implements a confirm form asking for the duplicate's admin_title.

To work around Core issue #2582295: Confirmation cancel links are incorrect if installed in a subdirectory, I implemented Webform's #2899166: WORKAROUND: Issue #2582295: Confirmation cancel links are incorrect if installed in a subdirectory, adding a @todo so it may hopefully be removed one day.

pancho’s picture

Here's the same with a test and screenshots:

operation link

Confirm form:
confirm screen

  • Pancho committed b0271be on 8.x-4.x
    Issue #1642268 by Pancho, Liam Morland: Allow duplicating a form with...
pancho’s picture

Title: Add Duplicate option to form configurations » Allow duplicating a form with all its fields
StatusFileSize
new10.05 KB
new440 bytes

Committed after fixing a minor issue in routing.yml.

I was too fast for the testbots to get the patches tested, but branch tests are passing, see here and here.

pancho’s picture

Version: 8.x-4.x-dev » 7.x-1.x-dev
Status: Needs review » Patch (to be ported)
Issue tags: -Needs tests +Needs backport to D7

Let's backport this to D7. It's a great, simple alternative to exporting and importing, if you just need a duplicate.

liam morland’s picture

Status: Patch (to be ported) » Closed (outdated)

Drupal 7 is no longer supported. If this applies to a supported version, please re-open.