Jump to content

Problems with page select inputfield


Soma
 Share

Recommended Posts

I experienced something strange when playing with users,roles,permission.

I created extra inputfield page reference in user template to select pages.

If I select a page that is unpublished it doesn't get saved, although it says it changed.

Screencast

Link to comment
Share on other sites

The FieldtypePage won't present unpublished page references in it's output. That Inputfield that you are using there will show all pages that you have access to. The strikethrough on it means that it's unpublished and not ready to be used for presentation, links, references, etc. It'll let you select it (unlike other Inputfields), and actually it does get stored. But when it comes time to load it again, it gets filtered out. It does it like this at load rather than save because a page that was published could now be unpublished, and likewise a page added in the API that was unpublished could now be published. Perhaps it shouldn't show unpublished pages in that PageList, but I figured the strikethrough here was clear enough and didn't want to add to the code complexity of the PageList process (which doesn't even know it's been used as an Inputfield). :)

Link to comment
Share on other sites

Hi, Ryan. I tried the scenario when I link from one page to another -> unpublish linked page -> the linked page doesn't show up in pageselect intutfeild. But if I republish it later, it appears again. So user can't even know that they have link to unpublished page, and can't delete it until they publish that page again. May I propose: if unpublished page is linked from somewere, not to hide it from user, just cross it out in pageselect inputfield too. That would eliminate any ambiguity.

Cheers and thank you for your great cms  :)

Link to comment
Share on other sites

While it sounds good, it's actually a bit complicated because it would mean that all Inputfields that can be used for selecting pages would have to check the Page's status and include some additional markup related to it.

ProcessWire lets you use any multiple-selection Inputfield for selecting pages, and the vast majority don't know what a Page is. They just know how to provide multiple selection. That means they are quite flexible and can be used in the API for any collection of items. But if I start building Page dependencies into Inputfields, then they suddenly become limited to Page selection. I'd rather keep them flexible... I need to keep PW's size reasonable at least until there is a bigger team behind it. :)

But the scenario that you point out is a good one. I am thinking the best way to handle it is for PW to include the unpublished pages in the 'selected' list if it detects that you are actually editing the page. This won't work with all Inputfields (which require the selected to be part of the selectable), but it will work with the PageListSelectMultiple that was shown in the YouTube video… and that Inputfield is the only one that can call out unpublished pages anyway.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...