Jump to content

Recommended Posts

Posted

hi,

if i do

   $stuff = $page->all_list;

   $stuff->filter('parent.name!=thing')

   echo $stuff // subset of all_list, all good

But, how do i get all_list again? (How do I reload all items)

   $stuff2 = $page->all_list; //returns filtered list = not good

thanks =)

J

Posted

filter() alters the pageArray for good. Do this instead:

$stuff = $page->all_list;
$stuff2 = $stuff->find('parent.name!=thing');

  • Like 1
Posted

thanks,

forgot to mention, $page->all_list; is a page list (page field), not child pages. So find doesn't seem to work

No other way to non-destructively filter a PageArray? Can I clone a PageArray?

Is there a way to force reload of the original items?

J

Posted
Can I clone a PageArray?

While not necessary here, you can of course also clone a page array (using the usual PHP method): 

$myClonedPageArray = clone $myPageArray; 
  • Like 1

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
×
×
  • Create New...