modules ) ) { $this->modules[ "mod$id" ] = new MMIndividualChangeCache( $id ); } return $this->modules[ "mod$id" ]; } } class MMIndividualChangeCache { // we're happy for these 2 parameters to be accessed directly - // no need for accessor methods. var $cache = array( "params"=>array() ); var $id; /** * Constructor * creates a new cache object with the given ID. */ function MMIndividualChangeCache( $id ) { $this->id = $id; } /** * setParam * $key a module parameter such as "pretext" or "posttext" (mod_login) * $value the value you want to change it to */ function setParam ( $key, $value ) { $this->cache[ 'params' ][ $key ] = $value; return $this; } /** * title * $string the new title for the module */ function title ( $string ) { $this->cache[ 'title' ] = $string; return $this; } /** * showTitle * $bool whether to show the title or hide it. Default is to show it. */ function showTitle ( $bool = true ) { $this->cache[ 'showtitle' ] = $bool ? 1 : 0; return $this; } /** * hideTitle * Hides the title of the module */ function hideTitle () { return $this->showTitle( false ); } /** * enable * $bool whether to enable the module or disable it. Default is to enable it. * Note that by default any module that you include in a MetaMod gets auto-published, * unless you change the MetaMod parameters. */ function enable( $bool = true ) { $this->cache[ 'published' ] = $bool ? 1 : 0; return $this; } function disable() { return $this->enable( false ); } function position( $string ) { $this->cache[ 'position' ] = $string; return $this; } /* completely change the type of the module, e.g. "mod_custom", "mod_metamod" */ function moduleType( $string ) { $this->cache[ 'module' ] = $string; return $this; } function accessLevel( $var ) { switch ( strtolower( $var ) ) { case "public": $var = 0; break; case "registered": $var = 1; break; case "special": $var = 2; break; } $this->cache[ 'access' ] = $var; return $this; } }