getkirby / kirby

Kirby's core application folder
https://getkirby.com
Other
1.27k stars 167 forks source link

[v4] Link Field: Allow custom queries for Pages/Files links #5279

Closed tobimori closed 1 year ago

tobimori commented 1 year ago

Description

I use a lot of "pseudo-pages" that have no real content but are instead only used for e.g. storing files.

CleanShot 2023-06-13 at 13 05 28@2x

It's impossible that a Page like Home can contain any assets in my setup, which is why I want to limit my users to be only able to select files in pages where files can be uploaded to.

In the same manner, I don't want my users to be able to select a page that has the template for such a "pseudo-page" as they never have any content and just redirect in the frontend.

CleanShot 2023-06-13 at 13 07 59@2x

Your setup

Kirby Version 4.0.0-alpha.2 (alpha-3 broke the file picker in the link field)

distantnative commented 1 year ago

I think we're sliding into feature request territory here to be honest. I think these should rather go on Nolt to be honest.

tobimori commented 1 year ago

I'm happy to share this on Nolt too, yet I don't think this would fit there as it's not really a new feature request, but rather embracing collaboration & discussion about features in active development.

You can kinda compare it to when you released the List field: Why was there no option to force it to a bulletList or orderedList, when the Writer field could do that? Having queries, toggling Link Field types, or other configuration options are expected from a Core feature that wants to replace plugins - it's not that such configuration options are new to Kirby, other fields had them from the beginning.

lukasbestle commented 1 year ago

I'd say we can treat this as an enhancement. If we still have time before the launch after all bugs are fixed, we can try to tackle this, otherwise we can move it to Nolt.

afbora commented 1 year ago

What would be syntax?

Option 1

fields:
  link:
    type: link
      options:
        page: site.children.filterBy('template', 'default')
        - anchor

Option 2

fields:
  link:
    type: link
      options:
        - page
        - anchor
      query:
        page: site.children.filterBy('template', 'default')
lukasbestle commented 1 year ago

Option 2 would certainly be consistent with the pages and files fields.

mrflix commented 1 year ago

I just ran into this problem too: pages that are otherwise hidden in pages sections via templatesIgnore and template show up in the link finder.

Intuitively I would expect to be able to use the same options to filter pages that I can use for page sections.

Out of the box I wouldn't even know where I could adjust this for the wysiwyg text-block link dialog. And since this is something I'll want for all link fields in a website I'm wondering if this wouldn't make more sense in my global config.

I'm sorry that the finder becomes more complex than it should be. It's such a great new feature!

tobimori commented 1 year ago

With v4 beta coming up, will this be implemented or not?

distantnative commented 1 year ago

@tobimori we'll be focusing on fixing bugs, ironing out some bumps and helping to smooth the transition for plugins for now

distantnative commented 1 year ago

I have decided to move this to https://kirby.nolt.io/574 I think this sounds definitely like something I'd like to tackle for 4.1, 4.2 - or even 4.0.

But right now we need to sort things a little bit into the right buckets to better overlook wehre we still have bugs, regressions etc. - but really not to disqualify this idea.

ovenum commented 7 months ago

Just having the same issue as @tobimori with the link field. Especially for sites with many pages/files or when using pseudo-pages to organise content. Without search or a pre-filtered tree it’a quite tedious for editors to find the right item. For my use case i’ll be going back to a classic pages field or files field with toggles. It would be great if the link field will get support for queries and search in the future.

This was moved to nolt but i think it’s on the border of feature-request and issue. Also GitHub seems to be the more fitting place to discuss the details of the query syntax and how this could be implemented.

lukasbestle commented 7 months ago

@ovenum In this closed issue the discussion will be lost. Please comment on Nolt, we can also discuss technical details there and work on the conception.