/** * Gets the list of ALL supported modules * Or the array with one necessary module if parameters is present * * @param array - array with the extension_id AND native flag * * @return array - the list of supported modules * @since 1.0 */ public static function getSupported($params = array()) { $extensions = array_merge(self::getNativeSupported(), self::getLocallySupported()); foreach ($extensions as &$item) { // Add the info about module if (!isset($params['withoutInfo'])) { $item->xml = MigurModuleHelper::getInfo($item->extension, $item->native); } if (empty($item->params)) { $item->params = "{}"; } $item->params = (object) json_decode($item->params, true); //HOTFIX: To match the properties with the result object of &_load. Need to implement the MODULE object. $item->module = $item->extension; // $result->id = 0; // $result->title = ''; // $result->module = $name; // $result->position = ''; // $result->content = ''; // $result->showtitle = 0; // $result->control = ''; // $result->params = ''; // $result->user = 0; // Try to find only one module if (isset($params['extension_id']) && isset($params['native']) && $params['extension_id'] == $item->extension_id && $params['native'] == $item->native) { return array($item); } } // If we are here then the necessary module could not found if (!empty($params['extension_id']) && !empty($params['native'])) { JError::raiseError(E_ERROR, "The module " . $params['extension_id'] . " could not found in the list of supported modules (native = " . $params['native'] . ")"); } return $extensions; }
/** * Get all the modules registered in DB * @return array * @since 1.0 */ public function getModules() { $res = array(); $extensions = $this->getItems(); foreach ($extensions as $item) { if ($item->type == NewsletterTableNextension::TYPE_MODULE) { $item->xml = MigurModuleHelper::getInfo($item->extension); $res[] = $item; } } return $res; }