/** * Get all ZM menu data. * * @todo refactor this back into a loader system */ protected function getMenuData() { $settingsService = $this->container->get('settingsService'); $menuFiles = $settingsService->get('apps.store.admin.menus'); $menuData = array(); // @todo support relative and absolute paths (and also placeholder paths) foreach ($menuFiles as $menuFile) { $menuData = Toolbox::arrayMergeRecursive($menuData, Yaml::parse($this->container->getParameter('zenmagick.root_dir') . '/' . $menuFile)); } $contextConfigLoader = $this->container->get('contextConfigLoader'); foreach ($contextConfigLoader->getMenus() as $pluginMenu) { $menuData = Toolbox::arrayMergeRecursive($menuData, $pluginMenu); } $configGroups = $this->container->get('configService')->getConfigGroups(); foreach ($configGroups as $group) { if ($group->isVisible()) { $id = strtolower($group->getName()); $id = str_replace(' ', '-', $id); $id = str_replace('/', '-', $id); $menuData['children']['configuration']['children']['configuration-legacy']['children'][$id] = array('label' => $group->getName(), 'route' => 'legacy_config', 'routeParameters' => array('groupId' => $group->getId())); } } return $menuData; }
/** * Merge in a map of settings. * * @param mixed settings Either a map of settings or another <code>Settings</code> instance. */ public function setAll($settings) { if ($settings instanceof Settings) { $settings = $settings->getAll(); } if (is_array($settings)) { $this->settings = Toolbox::arrayMergeRecursive($this->settings, $settings); } }
/** * Load mappings from all configured providers. * * @param array providers List of provider bean definitions. */ public function loadProviderMappings($providers) { foreach ($providers as $def) { if (null != ($provider = Beans::getBean($def)) && $provider instanceof SacsPermissionProvider) { $this->permissionProviders[] = $provider; foreach ($provider->getMappings() as $providerMapping) { $requestId = $providerMapping['rid']; $type = $providerMapping['type']; $name = $providerMapping['name']; // morph into something we can use if (!array_key_exists($requestId, $this->mappings['mappings'])) { $this->mappings['mappings'][$requestId] = array(); } $typeKey = null; switch ($type) { case 'role': $typeKey = 'roles'; break; case 'user': $typeKey = 'users'; break; } if (null != $typeKey) { $this->mappings['mappings'][$requestId] = Toolbox::arrayMergeRecursive($this->mappings['mappings'][$requestId], array($typeKey => array($name))); } } } } }
/** * Set formats. * * <p>Merge additional formats into this locale.</p> * * @param array formats Nested map of format definitions. */ public function setFormats($formats) { $this->formats = Toolbox::arrayMergeRecursive($this->formats, $formats); }
/** * Resolve config for the given context. * * @param string context The contex; default is <code>null</code> to use the current context. * @return array The complete configuration for the chosen context. */ public function resolve($context = null) { $context = $context ?: $this->getContext(); $cconfig = array(); foreach ($this->config as $key => $data) { if (in_array($key, array('meta', 'routing', 'container'))) { $cconfig[$key] = $data; // meta is special and is context independent } else { // context key if (Runtime::isContextMatch($key, $context)) { $cconfig = Toolbox::arrayMergeRecursive($cconfig, $data); } } } return $cconfig; }