static function initialize($config = array()) { foreach ($config as $key => $value) { self::${$key} = $value; } CMS::add_component(self::$name, new CMS_Factory_Mapper()); CMS_Admin::menu(self::$admin_menu_title, CMS::admin_path('factory'), 'puzzle.png'); }
static function initialize($config = array()) { foreach ($config as $key => $value) { self::${$key} = $value; } if (self::$disabled) { return; } CMS::add_component(self::$name, new CMS_Stockroom_Router()); CMS_Admin::menu(self::$admin_menu_title, CMS::admin_path('stockroom'), 'bookshelf.png'); }
static function initialize($config = array()) { self::options($config); CMS::add_component(self::$options['component']['name'], Core::make(self::$options['component']['mapper'])); CMS_Admin::menu('lang:_vars:title', CMS::admin_path('vars'), 'hammer-screwdriver.png'); }
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); } } }