Frontend\Core\Engine\Base\Widget::execute PHP Méthode

execute() public méthode

Execute the action If a javascript file with the name of the module or action exists it will be loaded.
public execute ( )
    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);
        }
    }

Usage Example

Exemple #1
0
 /**
  * Execute the extra
  *
  * @return void
  */
 public function execute()
 {
     // call parent
     parent::execute();
     // load template
     $this->loadTemplate();
 }
All Usage Examples Of Frontend\Core\Engine\Base\Widget::execute