I am writing a custom page method. I am trying to build a collection that excludes a particular page (and prepends it later on). But this does not seem to work:
The page ‘vessel’ is a child of site, so I assume the ID is right, but still does not seem to be excluded. Could it be I cannot call not() in this way from an extension?
When using a custom page method in a sortBy: option of a type:pages section, the method is applied to every page in the collection of pages in that section right? and the method needs to return the index where each page needs to be placed, correct?
In the reference (I’ve checked before asking) it has an example of prepend in a loop where the first argument is the key of the element position in the loop. I think I’ve been using $pages->prepend($page) without the id argument.
I now went and check the code for prepend under collection and if I am reading it right, I’d say the key argument is not mandatory is that correct ?
That also confuses me a bit. If a collection is ordered… why does it handle keys aswell ? is it both ordered and associative?