Problem/Motivation

When creating a new template it will already get the values from the default template, which is great.
But sometimes cloning another existing template would be very handy.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

thomas.frobieter created an issue. See original summary.

anybody’s picture

Issue tags: +Novice

Good idea for better sbx!

This should be quite simple to achieve, the functionality already exists in core and is used in many other contrib modules, e.g. pathauto:
https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Entity%21...

https://git.drupalcode.org/project/pathauto/-/blob/8.x-1.x/src/Form/Patt...

thomas.frobieter’s picture

Status: Active » Needs review
thomas.frobieter’s picture

Done. I tested the cloning regular and breakpoint templates, and everything seems to be working fine.

anybody’s picture

Status: Needs review » Needs work

Thanks @thomas.frobieter that looks and works great!

Still the path differs and should be unified with the existing paths.

Regarding the form and id change the maintainer should decide if it's okay like this. Great work!

bbu23’s picture

Hey guys, thx for reporting this issue and proposing a solution!
We'll review as soon as we get the chance (when the status is ready).

nk_’s picture

Great idea, thank you! Also, at the first glance, code changes seem neat.

One consideration, I would say that the path shall be like this, same as the other entity crud paths:
duplicate-form = /admin/structure/swiper-formatter/{swiper_formatter}/duplicate

Is there any particular reason to use /admin/config/content/ instead of /admin/structure/ prefix?

anybody’s picture

No, I commented the same, see MR.

nk_’s picture

Yeah, I got that but rather double-check with Thomas too, otherwise definitely it should be canonical (same base route).

anybody’s picture

Sorry, @thomas.frobieter just told me that not the new path, but the other existing paths in src/Entity/SwiperFormatter.php are wrong and he's correct!

Should be fixed in a separate bug report.

thomas.frobieter’s picture

right, see:
https://git.drupalcode.org/project/swiper_formatter/-/blob/cb98ae857cc3121dcd710eba94d06f18af254511/swiper_formatter.routing.yml

So /admin/config/x is correct, /admin/structure is wrong.

Should I create another issue to fix the paths in the SwiperFormatter.php?

nk_’s picture

Oh, yes, yes! No new issue I'd say.

nk_’s picture

Meaning, a new issue with path changes may be, but is also delicate at this moment *fo shur* so maybe after @bbu23 and I manage to make time to review. Plan?

thomas.frobieter’s picture

Sure, take your time, this definetly has no high priority - just a nice to have feature :)

bbu23’s picture

Since this is a feature request, and the finding is a bug report + now that we're trying to stick to conventional commits and semver, pls create a separate issue for the paths, link it to this one and I'll review that first. Thanks

bbu23’s picture

Cool, thx @anybody!

bbu23’s picture

The related issue has been fixed. The work on this ticket can resume.

bbu23 changed the visibility of the branch 2.1.x to hidden.

bbu23’s picture

Assigned: Unassigned » bbu23

  • bbu23 committed 1bdcf476 on 2.1.x
    test: #3572749 Add tests for duplicate entity and fix/improve preCreate...

bbu23’s picture

Assigned: bbu23 » Unassigned
Status: Needs work » Fixed

Ty for your contribution!

It will be available in version 2.1.0.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

anybody’s picture

Great @bbu23 thank you!

  • bbu23 committed c44777d2 on 2.1.x
    test: #3572749 Add kernel test for entity form serialization with...

  • bbu23 committed 13ce5b3b on 2.1.x
    fix: #3572749 Remove readonly from constructor-promoted properties for...

Status: Fixed » Closed (fixed)

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