Jump to content

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


bernhard
 Share

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

 

 

Link to comment
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
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...