rasteiner / k3-pagesdisplay-section

K3 plugin: display any page list in a section. Any parent, many parents, filtered, don't care.
Other
45 stars 8 forks source link

controls - Setting no longer working with 3.7. #17

Closed FynnZW closed 2 years ago

FynnZW commented 2 years ago

The setting controls: false (or "flag") no longer has an effect with Kirby 3.7. It's still working when downgrading Kirby to 3.6.6.

FynnZW commented 2 years ago

Kirby 3.7. uses items as computed instead of as a method. I think I found a solution, please check the PR

rasteiner commented 2 years ago

Perfect! Thanks :)

jaro-io commented 2 years ago

@rasteiner @FynnZW controls are now reversed on my side.. off by default and on only with controls: true. also controls: flag is not working on my side. cant get them to show at all with any of these values. are you experiencing this as well?

FynnZW commented 2 years ago

Are you using Kirby 3.7 or 3.6? On Kirby 3.6 it will probably conflict now, downgrading to plugin version 0.2.0 should solve that.

@rasteiner, might make sense to put this in a new minor version 0.3.0, so a composer upgrade doesn't automatically break older installations.

jaro-io commented 2 years ago

@FynnZW 3.7

FynnZW commented 2 years ago

Oh, that's strange. It's working correctly on my installation, with Kirby 3.7.0.2.

Maybe clearing the browser cache will solve it, so the new Plugin-JS gets loaded? Or deleting the media/panel-folder? (it gets generated again automatically)

rasteiner commented 2 years ago

Indeed strange, I've tested the patch before merging on the latest Kirby (3.7.0.2). Also 0.2.0 already requires Kirby 3.7

If deleting the media cache doesn't work, could you share the blueprint you're using?

jaro-io commented 2 years ago

so sorry you two! :grimacing: :roll_eyes: the blueprint i was testing this with already had a controls: false set. so i actually added a second option accidentally. so i can definitely confirm controls: false is working fine haha!

but on my side i can actually see no difference between controls: false and controls: flag. i’ve never used this option before, i was just curious. but i was expecting to see the little status circle at the end of each row, like with regular table layouts. but it’s not there. or is this not what should be happening?

hope i am not again doing something wrong? just tripple checked that the new plugin version 0.2.1 is installed correctly. updated & reinstalled all my composer dependencies. and i am on kirby 3.7.0.2 as well.

plugins
headline: Orders
type: pagesdisplay
layout: table
empty: No order found
status: published
controls: flag
templates:
    - order
sortBy: num desc
search: true
image: false
limit: 20
text: '#{{ page.invoiceNumber }}'
columns:
    orderid:
        label: Order ID
        width: 2/12
    invoicedate:
        label: Order date
        type: date
        display: MMM DD, YYYY h:mm a
        width: 2/12
    name:
        label: Name
        width: 2/12
    email:
        label: Email
        width: 3/12
    total:
        label: Total
        value: '{{ page.formattedSum }}'
        width: 1/12
        align: right
orders
rasteiner commented 2 years ago

I can confirm this. The table layout in the plugin doesn't show the status button.

rasteiner commented 2 years ago

Docs for future me

Kirby does magic here: https://github.com/getkirby/kirby/blob/3.7.0.2/config/sections/mixins/layout.php#L84-L91

A serverside mixin that is used in the pages section checks if the section type is "pages", in which case it injects an extra column for the flag status button. The latest commit fixes the missing button by setting a fake section type of "pages", which is then reset to "pagesdisplay" before sending it to the browser in toArray.

jaro-io commented 2 years ago

@rasteiner working beautifully! thank you!

jaro-io commented 2 years ago

@rasteiner whenever you have a few min, would you be so kind and release an updated composer package? 🌻 ✨

rasteiner commented 2 years ago

Sure, probably tomorrow. Didn't do it yet because the solution isn't really perfect: with controls: false and layout: table the plugin now shows an empty column where the controls were... But I guess I won't be able to fix that before vacation, so I'll just tag it once I get to a computer