protected function process_component_config($config_name = 'component') { $config = $this->config($config_name); // TODO: split to methods if (isset($config->admin_menu)) { $menu = (object) $config->admin_menu; CMS_Admin::menu($menu->caption, $menu->path, $menu->items, $menu->icon); } if (isset($config->templates)) { $helpers = $config->templates['helpers']; Templates_HTML::use_helpers($helpers); } if (isset($config->field_types)) { $types = $config->field_types; foreach ($types as $name => $class) { CMS::field_type($name, $class); } } if (isset($config->commands)) { $commands = $config->commands; foreach ($commands as $chapter => $data) { $args = array_merge(array($chapter, $data['name'], $data['callback']), isset($data['args']) ? $data['args'] : array()); call_user_func_array(array('CMS', 'add_command'), $args); } } if (isset($config->insertions)) { $insertions = $config->insertions; foreach ($insertions as $ins) { $args = array_merge(array($ins['class']), $ins['names']); call_user_func_array(array('CMS', 'register_insertions'), $args); } } if (isset($config->events)) { $events = $config->events; foreach ($events as $name => $callback) { Events::add_listener($name, $callback); } } if (isset($config->orm)) { $orm = $config->orm; foreach ($orm as $name => $class) { CMS::orm()->submapper($name, $class); } } }