library/core/class.controller.php
public function AddModule($Module, $AssetTarget = '') {
      $this->FireEvent('BeforeAddModule');
      $AssetModule = $Module;
      
      if (!is_object($AssetModule)) {
         if (property_exists($this, $Module) && is_object($this->$Module)) {
            $AssetModule = $this->$Module;
         } else {
            $ModuleClassExists = class_exists($Module);

            if ($ModuleClassExists) {
               // Make sure that the class implements Gdn_IModule
               $ReflectionClass = new ReflectionClass($Module);
               if ($ReflectionClass->implementsInterface("Gdn_IModule"))
                  $AssetModule = new $Module($this);
            }
         }
      }
      
      if (is_object($AssetModule)) {
         $AssetTarget = ($AssetTarget == '' ? $AssetModule->AssetTarget() : $AssetTarget);
         // echo '<div>adding: '.get_class($AssetModule).' ('.(property_exists($AssetModule, 'HtmlId') ? $AssetModule->HtmlId : '').') to '.$AssetTarget.' <textarea>'.$AssetModule->ToString().'</textarea></div>';
         $this->AddAsset($AssetTarget, $AssetModule, $AssetModule->Name());
      }

      $this->FireEvent('AfterAddModule');
   }
public function AddModule($Module, $AssetTarget = '') {
      $this->FireEvent('BeforeAddModule');
      $AssetModule = $Module;
      
      if (!is_object($AssetModule)) {
         if (property_exists($this, $Module) && is_object($this->$Module)) {
            $AssetModule = $this->$Module;
         } else {
            $ModuleClassExists = class_exists($Module);

            if ($ModuleClassExists) {
               // Make sure that the class implements Gdn_IModule
               $ReflectionClass = new ReflectionClass($Module);
               if ($ReflectionClass->implementsInterface("Gdn_IModule"))
                  $AssetModule = new $Module($this);
            }
         }
      }
      
      if (is_object($AssetModule)) {
         $AssetTarget = ($AssetTarget == '' ? $AssetModule->AssetTarget() : $AssetTarget);
         // echo '<div>adding: '.get_class($AssetModule).' ('.(property_exists($AssetModule, 'HtmlId') ? $AssetModule->HtmlId : '').') to '.$AssetTarget.' <textarea>'.$AssetModule->ToString().'</textarea></div>';
         $this->AddAsset($AssetTarget, $AssetModule, $AssetModule->Name());
      }

      $this->FireEvent('AfterAddModule');
   }
public function AddModule ( $ Module , $ AssetTarget = '' ) { $ this -> FireEvent ( 'BeforeAddModule' ) ; $ AssetModule = $ Module ; if ( ! is_object ( $ AssetModule ) ) { if ( property_exists ( $ this , $ Module ) && is_object ( $ this -> $ Module ) ) { $ AssetModule = $ this -> $ Module ; } else { $ ModuleClassExists = class_exists ( $ Module ) ; if ( $ ModuleClassExists ) { // Make sure that the class implements Gdn_IModule $ ReflectionClass = new ReflectionClass ( $ Module ) ; if ( $ ReflectionClass -> implementsInterface ( "Gdn_IModule" ) ) $ AssetModule = new $ Module ( $ this ) ; } } } if ( is_object ( $ AssetModule ) ) { $ AssetTarget = ( $ AssetTarget == '' ? $ AssetModule -> AssetTarget ( ) : $ AssetTarget ) ; // echo '<div>adding: '.get_class($AssetModule).' ('.(property_exists($AssetModule, 'HtmlId') ? $AssetModule->HtmlId : '').') to '.$AssetTarget.' <textarea>'.$AssetModule->ToString().'</textarea></div>'; $ this -> AddAsset ( $ AssetTarget , $ AssetModule , $ AssetModule -> Name ( ) ) ; } $ this -> FireEvent ( 'AfterAddModule' ) ; }
Adds the specified module to the specified asset target.

If no asset target is defined, it will use the asset target defined by the
module's AssetTarget method.

@param mixed $Module A module or the name of a module to add to the page.
@param string $AssetTarget
@todo $AssetTarget need the correct variable type and description.
Adds the specified module to the specified asset target .