Jump to content

Adding theme specific module hooks


Recommended Posts

How can I add a hook to a module for a specific theme?

 

I have this FrontController class (/override/classes/controller/FrontController.php:

 

class FrontController extends FrontControllerCore {

// Can't use parent::initContent in IndexController override
protected $addHomeHooks = false;

public function initContent() {
	parent::initContent();

	if ($this -> addHomeHooks) {
		$this -> context -> smarty -> assign(array(
			'currentController' => get_class($this),
			'HOOK_HOME_BANNER' => Hook::exec('displayHomeBanner'),
			'HOOK_HOME_TEXT' => Hook::exec('displayHomeText'),
		));
	}
}

}

 

and /override/controllers/front/IndexController.php:


class IndexController extends IndexControllerCore {
protected $addHomeHooks = true;
}

 

 

 

 

Now I want to be able to add a function to the editorial module:

public function hookDisplayHomeBanner(){
	//...
}

 

Except themes/<themename>/modules/editorial/editorial.php does not seem to be included..

 

How can I do this?

Edited by rubenvincenten (see edit history)
Link to comment
Share on other sites

  • 2 weeks later...
×
×
  • Create New...