bernhard Posted November 11, 2018 Posted November 11, 2018 Am I using it wrong or is this a bug? According to the docs it should support the array syntax, shouldn't it? Quote /** * Given a selector, return whether or not this Page matches it * * ~~~~~ * if($page->matches("created>=" . strtotime("today"))) { * echo "This page was created today"; * } * ~~~~~ * * @param string|Selectors|array $selector Selector to compare against (string, Selectors object, or array). * @return bool Returns true if this page matches, or false if it doesn't. * */ public function matches($selector) { // This method implements the WireMatchable interface return $this->comparison()->matches($this, $selector); }
AndZyk Posted November 11, 2018 Posted November 11, 2018 Just a wild guess, but maybe you could try this: $page->matches(["name=" => "ueber-uns"]);
bernhard Posted November 11, 2018 Author Posted November 11, 2018 14 minutes ago, AndZyk said: Just a wild guess, but maybe you could try this: $page->matches(["name=" => "ueber-uns"]); same
fbg13 Posted November 11, 2018 Posted November 11, 2018 public function matches($selector) { // This method implements the WireMatchable interface return $this->comparison()->matches($this, $selector); } @bernhard I think $this->comparison()->matches($this, $selector) is PageComparison->matches(Page $page, $s) which doesn't accept an array, it only checks for a string or int and a selector, else returns false. 1
bernhard Posted November 12, 2018 Author Posted November 12, 2018 You are right, so I guess the docs are misleading in this case.
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