valan Posted January 31, 2015 Share Posted January 31, 2015 There is page/template with repeater field. Among others fields, there is Page field inside that repeater. In admin, I need to generate a list of selectable pages for that Page filed dynamically, e.g. with help of custom PHP code. Custom PHP code has access only to $page and $pages, but I also need to know current repeater item... Is there any way to get current repeater item in custom PHP code (one you use to setup selectable pages)? P.S. yes, I know that this could be done having pages instead of repeaters...) Thanks! Link to comment Share on other sites More sharing options...
kongondo Posted January 31, 2015 Share Posted January 31, 2015 Trying to understand this...What exactly do you mean by 'current repeater item'? Link to comment Share on other sites More sharing options...
Jan Romero Posted January 31, 2015 Share Posted January 31, 2015 When you put a page field inside a repeater, the $page variable that field gets is the page you’re editing. Not the repeater page the field actually belongs to. Put another way, the $page variable will be the same as $repeateritem->getForPage(). What you want, however, is $repeateritem itself. Honestly, I doubt this is possible out of the box. Like you said, if you used “real” pages in a PageTable field, you would edit those pages in a modal window. I. e. the $page variable supplied to the page field’s custom select code would be the current PageTable item. I don’t want to be the guy who misses the point and answers “why don’t you just do something else”, but PageTables are so much cooler than repeaters anyway. Any specific problems that stop you from using those? 1 Link to comment Share on other sites More sharing options...
valan Posted January 31, 2015 Author Share Posted January 31, 2015 My production site runs PW 2.4 but PageTable is available starting from PW2.5) Looks like it is one more reason to upgrade.) 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