Robert Zelník Posted July 31, 2011 Share Posted July 31, 2011 I have a list of articles and a hierarchical tree of topics. In the "article" template I have added the "topics" field to link the topics. I would like to allow linking multiple topics from the whole tree. The "Dereference in API as" is set to "Multiple pages (PageArray)". My question is: which input field type should I choose in this case? SelectMultiple and AsmSelect allow to choose from the root topics only PageListSelectMultiple allows to choose from the whole tree, but it stores the root level only. When I choose from the nested level, this choice is ignored during saving. Is this a bug or a feature? (I use 2.1devel version of ProcessWire.) Link to comment Share on other sites More sharing options...
apeisa Posted July 31, 2011 Share Posted July 31, 2011 How have you configured your fieldtype? You probably have setting "Parent of selectable page(s)" -> this mean that you can select only direct children of the selected page - so it works as expected. Easiest solution is to have common template for all topics (ie. "topic"). Then leave "Parent of selectable page(s)" empty and select "topic" from "Template of selectable page(s)". If you don't have or don't want new template for your topics, then you have to write custom selector to "Alternate/custom code to find selectable pages". That is not very complicated, this should work: return $pages->get("/topics/")->find(); Code above assumes that you have page /topics/ which keeps your topics tree. And of course you could use ->get(5232) where 5232 is page id for your topics page (so that selector would work even if you decide to move your topics page). Link to comment Share on other sites More sharing options...
slkwrm Posted July 31, 2011 Share Posted July 31, 2011 @Apeisa: Thanks for the tip with custom selector. I didn't notice this field before I think it would be nice to extend PageListSelectMultiple's functionality so user could select not only direct children of selected page but also, optionally, all its descendants on lower levels. It would eliminate unncessary clicks to get to the parent of selectable pages (which you should do currently if you didn't select any parent) and user still would use three structure to select pages (which is not the case with SelectMultiple, AsmSelect and custom selector) limited by the branch under selected parent. Link to comment Share on other sites More sharing options...
ryan Posted July 31, 2011 Share Posted July 31, 2011 The PageListSelectMultiple is supposed to work with parent, at least that was the intention. If it's not working (not saving your descendent selections), then chances are it's a bug... An over-validation. As a temporary solution till I get back, try what Antti suggested, or just set no criteria at all for the pages, and see if you can just let it work with the entire site tree, temporarily. Link to comment Share on other sites More sharing options...
Robert Zelník Posted July 31, 2011 Author Share Posted July 31, 2011 When I unset the Parent of selectable page(s), the nested topics worked as expected. Link to comment Share on other sites More sharing options...
apeisa Posted July 31, 2011 Share Posted July 31, 2011 Yep, I tested this too now. If you set parent then it shows only short tree and allows to go deeper - but saving other than direct children doesn't work. So bug here. Link to comment Share on other sites More sharing options...
Robert Zelník Posted August 1, 2011 Author Share Posted August 1, 2011 Ok, reported here: https://github.com/ryancramerdesign/P21/issues/18 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now