Jump to content

Bug: PageListSelect deeper than 2level


Soma
 Share

Recommended Posts

I'm using latest dev. Multilanguage support and multilanguage page names.

I have a page field PageListSelectMultiple and a parent to select pages, no template spec.

Now I can't select a page that is more down than on root level from parent.

I get Page 5216 is not valid for select_download

No matter what setting. Multiple, single, template I always get this error and can't go on... This was never an issue.

Can anybody confirm?

Link to comment
Share on other sites

Hey Soma,

I just downloaded the latest dev right now.

I am still learning about language support, but I have these modules installed:

 
Languages Support    1.0.1    ProcessWire multi-language support.
Languages Support - Fields    1.0.0    Required to use multi-language fields.
Languages Support - Page Names    0.0.8    Required to use multi-language page names. Beta.
 
My pages have two name options for two different languages.
 
I set up a page field as you described and could select two levels down no problem.
 
Maybe I don't have the language setup configured the same way as you? but it seems to be working fine.
Link to comment
Share on other sites

Thanks so much adrian for testing! I think you have it right, but not sure, there's nothing that special on the language side, the root page has "/en/" and "/de/" for it's names.

Strange, as soon as I specify a template I can select and save the page that previously didn't work. So it also seems some pages work and some not.

Further more I have the custom page list label module installed and it stopped also working for some pages... *confused*

I will test again on a different install.  :undecided:

Link to comment
Share on other sites

I know there was some additions and changes right there where it checks for a valid page.

Playing around it works in older dev version, but not latest.

I figured that on my local install is_subclass_of($instance, "InputfieldPageListSelection") fails for me but shouldn't. Since this is only called when not on a direct child of the parent specified it won't even get to this check (for pages right under the parent).

I'm not sure is_subclass_of works same for all php version (5.3 5.4) and since the InputfieldPageListSelection is only a interface (implements) I'm not sure what's about it.

I also noticed some strange parents() results on those page while testing. No idea why.

Link to comment
Share on other sites

i.e. for me

$f = $fields->get("select_download");

if(is_subclass_of($f->inputfield, 'Inputfield')) {
    echo "is subclass";
}

works locally with php 5.3.1

while

$f = $fields->get("select_download");

if(is_subclass_of($f->inputfield, 'InputfieldPageListSelection')) {
    echo "is subclass";
}
 

doesn't work.

But it does work on another server with php 5.3.8. 

Link to comment
Share on other sites

Soma, reading through php.net, it sounds like versions of PHP prior to 5.3.8 had incorrect behavior for is_subclass_of(). In those versions, the only straightforward way to determine it is I guess to use Reflection. I've added a PHP version check which falls back to Reflection in older versions of PHP, but don't have a PHP version to test it out with. Do you want to try replacing your /wire/modules/Inputfield/InputfieldPage/InputfieldPage.module with the attached and let me know if this resolves the issue?

InputfieldPage.module

  • Like 2
Link to comment
Share on other sites

  • 2 weeks later...

Does the PageListSelect (or AsmSelect) also work with pages that have multiple fields?

When I use PageListSelect I can see the children pages from the parent page but when I select one it's gone when I save the page. When using AsmSelect the select menu is tiny and shows no items at all. The page field has the title field set as label field and single page as dereference.

It works fine when I have a list of children pages that only have a title field.

Link to comment
Share on other sites

In the meantime I changed my approach....

I have a category/template 'events' that calls fields from a category/template 'people' and one 'places'.

$namepage = $pages->get("template=bfd_people, id=$page->bfd_events_people_id");
        $occupation = ucfirst($namepage->bfd_people_occupation->title);
        if($namepage->bfd_people_original) {
		$originally = ", originally " . $namepage->bfd_people_original;
		};
		if($namepage->bfd_people_alias) {
		$alias = " aka " . $namepage->bfd_people_alias;
		};
        echo "<b><a href='{$namepage->url}'>{$occupation} {$namepage->bfd_people_name_first} {$namepage->bfd_people_name_middle} {$namepage->bfd_people_name_last}{$originally}{$alias} </a></b>";

Before I was using "$namepage = $pages->get("template=bfd_people, title=$page->bfd_events_people_title");". To facilitate input I wanted "bfd_events_people_title" to be a select field (field as page and inputfield as AsmSelect). For some reason the titles showed up in the selectlist, I could select one but it disappeared upon save.

Using 'id' as reference proves better because 'title' can change in the course of time.

So to rephrase my question, could the AsmSelect field use the child pages (that have multiple fields) of the 'people' category as select items?

And one step further, could I have an AsmSelect list that shows the 'title' fields as select items but yet input their 'id' in the 'bfd_events_people_id' field?

Link to comment
Share on other sites

So to rephrase my question, could the AsmSelect field use the child pages (that have multiple fields) of the 'people' category as select items?

You should be able to specify whatever you want the option labels to be in the field's settings (input tab). If you want to specify multiple fields, get the FieldtypeConcat module, which helps to accomplish this. 

And one step further, could I have an AsmSelect list that shows the 'title' fields as select items but yet input their 'id' in the 'bfd_events_people_id' field?

Of course, this is the way that page references work by default. ProcessWire only stores references to a page (by ID). The title is just a label for selection purposes, nothing more. 

Link to comment
Share on other sites

  • 2 weeks later...

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...