/** * {@inheritdoc} */ public function getElementByPathParts(array $pathParts) { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'getElementByPathParts'); if (!$pluginInfo) { return parent::getElementByPathParts($pathParts); } else { return $this->___callPlugins('getElementByPathParts', func_get_args(), $pluginInfo); } }
/** * Convert xml config paths to decorated names * * @param array $paths * @return array * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ protected function _getSystemConfigPathsParts($paths) { $result = $urlParams = $prefixParts = []; $scopeLabel = __('Default Config'); if ($paths) { /** @var $menu \Magento\Backend\Model\Menu */ $menu = $this->_menuConfig->getMenu(); $item = $menu->get('Magento_Backend::stores'); // create prefix path parts $prefixParts[] = ['title' => __($item->getTitle())]; $item = $menu->get('Magento_Config::system_config'); $prefixParts[] = ['title' => __($item->getTitle()), 'url' => $this->getUrl('adminhtml/system_config/')]; $pathParts = $prefixParts; foreach ($paths as $pathData) { $pathDataParts = explode('/', $pathData['path']); $sectionName = array_shift($pathDataParts); $urlParams = ['section' => $sectionName]; if (isset($pathData['scope']) && isset($pathData['scope_id'])) { switch ($pathData['scope']) { case 'stores': $store = $this->_storeManager->getStore($pathData['scope_id']); if ($store) { $urlParams['website'] = $store->getWebsite()->getCode(); $urlParams['store'] = $store->getCode(); $scopeLabel = $store->getWebsite()->getName() . '/' . $store->getName(); } break; case 'websites': $website = $this->_storeManager->getWebsite($pathData['scope_id']); if ($website) { $urlParams['website'] = $website->getCode(); $scopeLabel = $website->getName(); } break; default: break; } } $pathParts[] = ['title' => $this->_configStructure->getElement($sectionName)->getLabel(), 'url' => $this->getUrl('adminhtml/system_config/edit', $urlParams)]; $elementPathParts = [$sectionName]; while (count($pathDataParts) != 1) { $elementPathParts[] = array_shift($pathDataParts); $pathParts[] = ['title' => $this->_configStructure->getElementByPathParts($elementPathParts)->getLabel()]; } $elementPathParts[] = array_shift($pathDataParts); $pathParts[] = ['title' => $this->_configStructure->getElementByPathParts($elementPathParts)->getLabel(), 'scope' => $scopeLabel]; $result[] = $pathParts; $pathParts = $prefixParts; } } return $result; }