New feature - parentMethod
This commit is contained in:
parent
bbfa1fb48e
commit
20432dbf43
|
@ -147,6 +147,7 @@ class Page extends fileContent
|
|||
return '/'.$htmlPath.'/'.$tmp;
|
||||
}
|
||||
|
||||
// Returns the parent key, if the page doesn't have a parent returns FALSE.
|
||||
public function parentKey()
|
||||
{
|
||||
$explode = explode('/', $this->getField('key'));
|
||||
|
@ -157,6 +158,18 @@ class Page extends fileContent
|
|||
return false;
|
||||
}
|
||||
|
||||
// Returns the parent method output, if the page doesn't have a parent returns FALSE.
|
||||
public function parentMethod($method)
|
||||
{
|
||||
global $pages;
|
||||
|
||||
if( isset($pages[$this->parentKey()]) ) {
|
||||
return $pages[$this->parentKey()]->{$method}();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function children()
|
||||
{
|
||||
$tmp = array();
|
||||
|
|
Loading…
Reference in New Issue