From: Daniel Cannon Date: Wed, 18 Jul 2007 05:25:53 +0000 (+0000) Subject: (bug 10602) API: Add two protected accessors to ApiMain allowing extending class... X-Git-Tag: 1.31.0-rc.0~52037 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/ajouter.php?a=commitdiff_plain;h=d567a44eae592f77b3e07ca42f3261d88c9e51b1;p=lhc%2Fweb%2Fwiklou.git (bug 10602) API: Add two protected accessors to ApiMain allowing extending class to add to or override existing modules and formats. --- diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php index ceb16d24cd..24ba75cd1b 100644 --- a/includes/api/ApiMain.php +++ b/includes/api/ApiMain.php @@ -481,6 +481,31 @@ class ApiMain extends ApiBase { $vers[] = ApiFormatFeedWrapper :: getVersion(); // not accessible with format=xxx return $vers; } + + /** + * Add or overwrite a module in this ApiMain instance. Intended for use by extending + * classes who wish to add their own modules to their lexicon or override the + * behavior of inherent ones. + * + * @access protected + * @param $mdlName String The identifier for this module. + * @param $mdlClass String The class where this module is implemented. + */ + protected function addModule( $mdlName, $mdlClass ) { + $this->mModules[$mdlName] = $mdlClass; + } + + /** + * Add or overwrite an output format for this ApiMain. Intended for use by extending + * classes who wish to add to or modify current formatters. + * + * @access protected + * @param $fmtName The identifier for this format. + * @param $fmtClass The class implementing this format. + */ + protected function addFormat( $fmtName, $fmtClass ) { + $this->mFormats[$fmtName] = $fmtClass; + } } /**