public function execute()
{
// build path to the module
$frontendModulePath = FRONTEND_MODULES_PATH . '/' . $this->getModule();
// build URL to the module
$frontendModuleURL = '/src/Frontend/Modules/' . $this->getModule() . '/Js';
// add javascript file with same name as module (if the file exists)
if (is_file($frontendModulePath . '/Js/' . $this->getModule() . '.js')) {
$this->header->addJS($frontendModuleURL . '/' . $this->getModule() . '.js', true, true, Header::PRIORITY_GROUP_WIDGET);
}
// add javascript file with same name as the action (if the file exists)
if (is_file($frontendModulePath . '/Js/' . $this->getAction() . '.js')) {
$this->header->addJS($frontendModuleURL . '/' . $this->getAction() . '.js', true, true, Header::PRIORITY_GROUP_WIDGET);
}
}