Jump to content

How does PW do that both $page->children and $page->children() work?


bernhard
 Share

Recommended Posts

Hi everybody!

PW somehow bypasses calls to a property of an object to an existing method with the same name. I think I read that some time ago but can't find the place in the code where this magic happens.

Thx for your help ?

Link to comment
Share on other sites

See the Page class (/wire/core/Page.php), especially the static array $baseProperties. For children, see this line. The magic itself happens in the method get(). For children(), this line, i.e.:

// snip
else if($type === 'm') {
				// local method
				return $this->{$key}();// magic :-)

 

  • Like 5
  • Thanks 1
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...