Problem/Motivation

Sometimes admins need to create a fairly similar form

Proposed resolution

Add a clone tab that allows a form to be cloned

Remaining tasks

All

User interface changes

New form for cloning

API changes

None

Data model changes

None

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

larowlan created an issue. See original summary.

larowlan’s picture

Assigned: Unassigned » larowlan
larowlan’s picture

Assigned: larowlan » Unassigned
Status: Active » Needs review
FileSize
9.94 KB
larowlan’s picture

And a tab

benjy’s picture

Looks good to me, just one question in the clone submit handler.

+++ b/src/Form/ContactFormCloneForm.php
@@ -0,0 +1,146 @@
+              'uuid' => NULL,
...
+      'uuid' => NULL,
...
+        'uuid' => NULL,

When do these get filled in? I'd have thought you'd have a new uuid if you've saved the new $contact_form above?

larowlan’s picture

#5 correct, they're not filled, will sort

larowlan’s picture

Actually, the field config ones are, the form one isn't

larowlan’s picture

Fixes UUID issue with the form

  • larowlan committed 5a94c82 on 8.x-1.x
    Issue #2716995 by larowlan: Allow cloning of forms - tab
    
  • larowlan committed 64a8738 on 8.x-1.x
    Issue #2716995 by larowlan: Allow cloning of forms - UUID fix
    
  • larowlan committed 9eb78a2 on 8.x-1.x
    Issue #2716995 by larowlan: Allow cloning of forms
    
  • larowlan committed cbe59da on 8.x-1.x
    Issue #2716995 by larowlan: Allow cloning of forms - test coverage
    
larowlan’s picture

Status: Needs review » Fixed
andypost’s picture

Why that incorporated into module?
There should be generic solution a-la bundle_copy module or maybe a part of "entity" module

larowlan’s picture

bundle_copy isn't getting ported to D8 because it can be done using the config import/export forms in core.
However this isn't something that I'd want exposed to users who're building contact forms (which are those who'd be building webforms on D7).
This gives them a nice UI.

Happy to discuss removing it into a separate module if you feel strongly about it.

jibran’s picture

Happy to discuss removing it into a separate module if you feel strongly about it.

I think we can leave it here for now until we'll have a complete solution in entity module.

Berdir’s picture

I think what you said is exactly why bundle_copy should exist in 8.x :)

andypost’s picture

Status: Fixed » Closed (fixed)

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

RKopacz’s picture

@larowlan I am looking for an easy way to do in D8 what I was able to do with Bundle Copy: Just export a node bundle and import it into another Drupal site. I'm not sure CMI can accommodate this as easily as Bundle Copy could do it in 7 It seems as though you can only import to a cloned version of the site on which the bundle was created in the first place. Do you know of any documentation on using SMI like Bundle Copy? Because I haven't been able to find it anywhere.

larowlan’s picture

@RKopacz, see drupal.org/project/entity_clone

RKopacz’s picture

@larowlan I'm surprised that didn't come up in any of my searches. I'll have a look at that.