/** * @param mixed $handler_id The ID of the handler. * @param Array $args The argument list. * @param Array &$data The local request data. * @return boolean Indicating success. */ public function _handler_view($handler_id, array $args, array &$data) { $data['name'] = $args[0]; if (!midcom::get('componentloader')->is_installed($data['name'])) { throw new midcom_error_notfound("Component {$data['name']} is not installed."); } $componentpath = midcom::get('componentloader')->path_to_snippetpath($data['name']); // Load and parse the global config $cfg = midcom_baseclasses_components_configuration::read_array_from_file("{$componentpath}/config/config.inc"); if (!$cfg) { // hmmm... that should never happen $cfg = array(); } $config = new midcom_helper_configuration($cfg); // Go for the sitewide default $cfg = midcom_baseclasses_components_configuration::read_array_from_file("/etc/midgard/midcom/{$data['name']}/config.inc"); if ($cfg !== false) { $config->store($cfg, false); } // Finally, check the sitegroup config $cfg = midcom_baseclasses_components_configuration::read_array_from_snippet("{$GLOBALS['midcom_config']['midcom_sgconfig_basedir']}/{$data['name']}/config"); if ($cfg !== false) { $config->store($cfg, false); } $data['config'] =& $config; $this->_update_breadcrumb($data['name']); $this->_prepare_toolbar($data); midcom::get('head')->set_pagetitle($data['view_title']); }
private function _load_configs($component, $object = null) { $componentpath = midcom::get('componentloader')->path_to_snippetpath($component); // Load and parse the global config $cfg = midcom_baseclasses_components_configuration::read_array_from_file("{$componentpath}/config/config.inc"); if (!$cfg) { // Empty defaults $cfg = array(); } $config = new midcom_helper_configuration($cfg); if ($object) { $topic_config = new midcom_helper_configuration($object, $component); } // Go for the sitewide default $cfg = midcom_baseclasses_components_configuration::read_array_from_file("/etc/midgard/midcom/{$component}/config.inc"); if ($cfg !== false) { $config->store($cfg, false); } // Finally, check the sitegroup config $cfg = midcom_baseclasses_components_configuration::read_array_from_snippet("{$GLOBALS['midcom_config']['midcom_sgconfig_basedir']}/{$component}/config"); if ($cfg !== false) { $config->store($cfg, false); } if (isset($topic_config)) { $config->store($topic_config->_local); } return $config; }