public function add($key, $value = null)
 {
     if (!$key instanceof SupsysticSlider_Ui_Asset) {
         throw new InvalidArgumentException('Parameter 1 must be instance of SupsysticSlider_Ui_Asset.');
     }
     parent::add($key->getHandle(), $key);
     return $this;
 }
예제 #2
0
 /**
  * Retrieves modules and doing initialization
  */
 public function init()
 {
     $config = $this->environment->getConfig();
     $hasHooksPrefix = $config->has('hooks_prefix');
     $modules = $this->getModulesList();
     /** @var Rsc_Mvc_Module $instance */
     foreach ($modules as $name => $instance) {
         /* Set http request to the module */
         $instance->setRequest($this->request)->onInit();
         /* Register hooks */
         $index = $this->environment->getPluginPath() . '/index.php';
         // register_activation_hook($index, array($instance, 'onInstall'));
         register_deactivation_hook($index, array($instance, 'onDeactivation'));
         if ($name === 'installer') {
             register_uninstall_hook($index, array(get_class($instance), 'onUninstall'));
         }
         /* We add module's location to the template & config loaders */
         /** @var Twig_Loader_Filesystem $loader */
         try {
             $loader = $this->environment->getTwig()->getLoader();
             $loader->addPath($instance->getLocation() . '/views', strtolower($name));
             // Add PRO module path to the @namespace.
             if ($instance->getOverloadController()) {
                 $prefix = $config->get('pro_modules_prefix');
                 $location = $config->get('pro_modules_path') . DIRECTORY_SEPARATOR . $prefix . DIRECTORY_SEPARATOR . ucfirst($name);
                 $loader->addPath($location . '/views', strtolower($name) . '_pro');
             }
         } catch (Twig_Error_Loader $e) {
         }
         $configLoader = $config->getLoader();
         $configLoader->add($instance->getLocation() . '/configs', strtolower($name));
         if ($instance->getOverloadController()) {
             $prefix = $config->get('pro_modules_prefix');
             $location = $config->get('pro_modules_path') . DIRECTORY_SEPARATOR . $prefix . DIRECTORY_SEPARATOR . ucfirst($name);
             $configLoader->add($location . '/configs', strtolower($name) . '_pro');
         }
         /* Add module to the resolver */
         $this->modules->add(strtolower($name), $instance);
         if ($hasHooksPrefix) {
             do_action($config->get('hooks_prefix') . 'after_' . strtolower($name) . '_loaded', $this->modules[strtolower($name)]);
         }
         // Try to load global configs for the current module.
         $basepath = $this->environment->getPluginPath() . '/app/configs';
         $filepath = '/modules/' . $instance->getModuleName() . '.php';
         if (file_exists($basepath . $filepath)) {
             $config = $this->environment->getConfig();
             $config->load($filepath);
         }
     }
     if ($hasHooksPrefix) {
         do_action($config->get('hooks_prefix') . 'after_modules_loaded');
     }
 }
예제 #3
0
 /**
  * {@inheritdoc}
  */
 public function add($key, $value)
 {
     $this->callListener('onAdd', $key, $value);
     return parent::add($key, $value);
 }