/** * 2016-08-02 * @param string $tabName * @param string $tabProperty * @return string|null */ public static function tab($tabName, $tabProperty) { /** @var Structure $s */ $s = df_config_structure(); if (!isset($s->_data['tabs'])) { $s->getTabs(); } return dfa(dfa($s->_data['tabs'], $tabName, []), $tabProperty); }
/** * 2016-08-02 * *) По аналогии с @see \Magento\Config\Block\System\Config\Form::initForm() * *) Мы не можем кэшировать результат, потому что возвращаемые объекты - это приспособленцы (fleweights). * *) Метод не может вернуть обект класса @see \Magento\Config\Model\Config\Structure\Element\Tab * потому что идентификатор вкладки не входит в $path. * Для получения данных вкладки используйте метод @see \Df\Config\Model\Config\Structure::tab() * Для получения названия вкладки используйте функцию @see df_config_tab_label() * * @param string $path * @param bool $throw [optional] * @param string|null $expectedClass [optional] * @return IElement|Field|Group|Section|null */ function df_config_e($path, $throw = true, $expectedClass = null) { /** @var IElement|Field|Group|Section|null $result */ $result = df_config_structure()->getElement($path); if (!$result && $throw) { df_error_html(__("Unable to read the configuration node «<b>%1</b>»", $path)); } return !$result || !$expectedClass || $result instanceof $expectedClass ? $result : df_error_html(__("The configuation node «<b>%1</b>» should be an instance of the <b>%2</b> class, " . "but actually it is an instance of the <b>%3</b> class.", $path, $expectedClass, df_cts($result))); }
/** * 2016-08-02 * @return string */ protected function label() { if (!isset($this->{__METHOD__})) { /** @var string[] $pathA */ $pathA = explode('/', $this->getPath()); /** @var Phrase[] $resultA */ $resultA = []; /** @var IConfigElement|ConfigElement|Section|null $e */ while ($pathA && ($e = df_config_structure()->getElementByPathParts($pathA))) { $resultA[] = $e->getLabel(); array_pop($pathA); } $resultA[] = df_config_tab_label($e); $resultA = array_reverse($resultA); $resultA[] = $this->labelShort(); $this->{__METHOD__} = implode(' → ', df_quote_russian($resultA)); } return $this->{__METHOD__}; }