Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

order of list items of changeTemplate is ignored #2161

Closed
j3ll3yfi5h opened this issue Oct 1, 2019 · 7 comments

Comments

@j3ll3yfi5h
Copy link

@j3ll3yfi5h j3ll3yfi5h commented Oct 1, 2019

Describe the bug

options:
  changeTemplate:
    - b_template
    - a_template
    - c_template

The ordering in the template selection dropdown is alphabetical instead of the defined order.

To Reproduce
Steps to reproduce the behavior:

  1. Add a blueprint
  2. Define changeTemplate with at least two different templates in a specific order (not alphabetical)
  3. Add a page, set a template
  4. Change template and notice, that the order in the blueprint is ignored

Expected behavior
Order of templates should be as defined in the blueprint.

Screenshots
Bildschirmfoto 2019-10-01 um 13 48 56

Kirby Version
3.2.5

@afbora

This comment has been minimized.

Copy link
Contributor

@afbora afbora commented Oct 1, 2019

I don't know if this is a bug, but the line that cause it:

https://github.com/getkirby/kirby/blob/develop/src/Cms/Page.php#L263

@j3ll3yfi5h

This comment has been minimized.

Copy link
Author

@j3ll3yfi5h j3ll3yfi5h commented Oct 1, 2019

@afbora It works with create, but not with changeTemplate, shouldn't it have the same behaviour on both places?

@afbora

This comment has been minimized.

Copy link
Contributor

@afbora afbora commented Oct 1, 2019

@j3ll3yfi5h You right and works for me. Just comment the asort line to try.

image (2)

@j3ll3yfi5h

This comment has been minimized.

Copy link
Author

@j3ll3yfi5h j3ll3yfi5h commented Oct 1, 2019

@afbora yes, that's it!

@lukasbestle

This comment has been minimized.

Copy link
Contributor

@lukasbestle lukasbestle commented Oct 1, 2019

I think the sorting is only there to ensure that the current template (which is always included in the list) gets inserted at the correct position in the list. But I think it would be fine to add the current template at the end (which will happen if we remove the asort() line) as this only affects cases where the changeTemplate option doesn't include the current template. If it's already included, the custom position would be respected.

@distantnative

This comment has been minimized.

Copy link
Contributor

@distantnative distantnative commented Oct 11, 2019

I would agree that we could get rid of the sorting - it is not important that the current template it inserted alphabetically. However, I would suggest to add the current template at the top instead of the bottom, @lukasbestle. Would work better with the select dropdowns.

@distantnative distantnative self-assigned this Oct 11, 2019
distantnative added a commit that referenced this issue Oct 11, 2019
distantnative added a commit that referenced this issue Oct 11, 2019
distantnative added a commit that referenced this issue Oct 11, 2019
distantnative added a commit that referenced this issue Oct 11, 2019
distantnative added a commit that referenced this issue Oct 11, 2019
bastianallgeier added a commit that referenced this issue Oct 13, 2019
@bastianallgeier

This comment has been minimized.

Copy link
Contributor

@bastianallgeier bastianallgeier commented Oct 13, 2019

@bastianallgeier bastianallgeier added this to the 3.3.0 milestone Oct 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.