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

add button #6

Closed jaumeferretevazquez closed 3 years ago

jaumeferretevazquez commented 3 years ago

Thank you for this fantastic plugin.

Is the inability to "add" pages to the displayed collection a result of how pagesdisplay works (as it queries a diverse collection), a kirby limitation or of something else entirely ?

I would be interested in something like pagesdisplay but which allows me to ADD pages... so I can show and add subpages from anywhere in the panel, like a tab in site.yml

Thanks

plagasul commented 3 years ago

That was actually posted by me using the wrong account :)

rasteiner commented 3 years ago

It's a limitation of this plugin to keep stuff easy and simple. Are you sure you need this plugin? Keep in mind that there's a parent property in the normal pages section.

Normally people use this plugin if they want to show pages from many parents. Having an "Add" button therefore is excluded by the fact that we wouldn't know where to put the created pages.

It's also not really possible to make sure (for me, as plugin author) that the created pages always match the given query; it would therefore be possible to create sections that create pages that then simply disappear (bad user experience).

For these reasons I arbitrarily decided to disable the add button in all cases.

You could use a different section for drafts (with a normal pages section) where you create the new pages.

Or could modify your copy of this plugin by deleting the rows 54-56 of the src/PagesDisplaySection.php file:

-        'add' => function () {
-            return false;
-        },

This should allow you to see the add button (and it should function like the normal button). Just make sure the to set a correct parent and template, to be sure it matches your query.

plagasul commented 3 years ago

@rasteiner Thank you for the answer and, yes, I just learned about the parent property of the pages section, which I can't believe I was not aware of, which does what I wanted.

Pagesdisplay is still really useful for showcasing mixed collections.

Thanks!

rasteiner commented 3 years ago

great :)