Jump to content

Siblings, get and selector problem


owzim
 Share

Recommended Posts

Hi,

I want to get a page which is one of the current page's siblings. It's hidden and the following problem occurs:

Case 1: Works if specified page is not hidden, but it has to be hidden, so not an option.

$page->siblings->get("name=some-name");

Case 2: Returns a null page

$page->siblings->get("name=some-name, include=hidden");

Case 3: Works

$page->siblings("name=some-name, include=hidden")->first();

Case 2 should work, but it doesn't.

Bug or feature?

Link to comment
Share on other sites

Not completely sure, but I think get($selector) only works with $pages and not with other array objects, as opposed to get($key).

You have one more option though:

$pages->get("parent={$page->parent}, name=some-name, include=hidden");
Link to comment
Share on other sites

The strange thing is, that PageArray::get() is internally just syntactic sugar for $pa->find()->first(). So does this work?

$page->siblings->find("name=some-name, include=hidden")->first();

Maybe the returned PageArray of siblings is already excluding your hidden page.

Link to comment
Share on other sites

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