Ferreteria/v2/trait/ftExecutableTree

From Woozle Writes Code
< Ferreteria‎ | v2
Revision as of 17:39, 19 January 2019 by htyp>Woozle (Created page with "{{page/code/class}} * '''file''': {{l/ferreteria/file|page/page.php}} * '''uses''': {{l/version|trait|ftExecutableTwig}} * '''used by''': ** {{l/version|class|fcNavBase}} ** {...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Template:Page/code/class

// PURPOSE: So an ExecutableTwig node will pass events down to its subnodes
trait ftExecutableTree {
    use ftExecutableTwig;

    // ++ OVERRIDE ++ //

    public function DoEvent($nEvent) {
	$this->OnEventBefore($nEvent);
	if ($this->HasNodes()) {
	    $ar = $this->GetNodes();
	    foreach ($ar as $name => $oNode) {
		$oNode->DoEvent($nEvent);
	    }
	}
	$this->OnEventAfter($nEvent);
    }
    
    // -- OVERRIDE -- //
    // ++ NEW ++ //

    // PURPOSE: by default, Self handles event before passing it down
    protected function OnEventBefore($nEvent)	{ $this->OnEventDispatch($nEvent); }
    protected function OnEventAfter($nEvent)	{}	// stub
    
    // -- NEW -- //
    
}