Example #1
0
 /**
  * Add asset paths for a plugin.
  * 
  * @param string $pluginModuleName The module name for the plugin.
  * @param string $themeType The type of theme: 'admin' or 'public'.
  * @return void
  */
 protected function _addPluginPaths($themeType, $pluginModuleName = null)
 {
     // If we have chosen a specific module to add paths for.
     if ($pluginModuleName) {
         // We need to add the scripts in reverse order if how they will be found.
         // add the scripts from the other modules
         $otherPluginScriptDirs = $this->_pluginMvc->getModuleViewScriptDirs(null);
         foreach ($otherPluginScriptDirs as $otherPluginModuleName => $scriptPathSet) {
             if ($otherPluginModuleName != $pluginModuleName && isset($scriptPathSet[$themeType])) {
                 foreach ($scriptPathSet[$themeType] as $scriptPath) {
                     $this->_addPathToView($scriptPath);
                 }
             }
         }
         // add the scripts from the first module
         $pluginScriptDirs = $this->_pluginMvc->getModuleViewScriptDirs($pluginModuleName);
         if (isset($pluginScriptDirs[$themeType])) {
             foreach ($pluginScriptDirs[$themeType] as $scriptPath) {
                 $this->_addPathToView($scriptPath);
             }
         }
         // Adds plugin-specific scripts for themes (these take precedence over everything)
         $this->_addOverridePathForPlugin($themeType, $pluginModuleName);
     } else {
         // We have not chosen a specific module to add paths for, so just add
         // them all (for the specific theme type, 'admin' or 'public').
         $pluginScriptDirs = $this->_pluginMvc->getModuleViewScriptDirs(null);
         foreach ($pluginScriptDirs as $moduleName => $scriptPathSet) {
             if (array_key_exists($themeType, $scriptPathSet)) {
                 foreach ($scriptPathSet[$themeType] as $scriptPath) {
                     $this->_addPathToView($scriptPath);
                 }
             }
         }
     }
 }