Jump to content
bernhard

Bug? $page->matches( selector-array-syntax )

Recommended Posts

Qc9IGLd.png

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);
	}

 

 

Share this post


Link to post
Share on other sites

Just a wild guess, but maybe you could try this:

$page->matches(["name=" => "ueber-uns"]);

 

Share this post


Link to post
Share on other sites
14 minutes ago, AndZyk said:

Just a wild guess, but maybe you could try this:


$page->matches(["name=" => "ueber-uns"]);

same

Share this post


Link to post
Share on other sites
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.

 

  • Like 1

Share this post


Link to post
Share on other sites

You are right, so I guess the docs are misleading in this case.

Share this post


Link to post
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

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...