/** * Check a configuration element visibility * * @param \Magento\Config\Model\Config\Structure\AbstractElement $element The config composite element * @param string $scope The element scope * * @return bool */ public function isVisible(\Magento\Config\Model\Config\Structure\AbstractElement $element, $scope) { if (!$element->isAllowed()) { return false; } $isVisible = parent::isVisible($element, $scope); if ($isVisible) { $isVisible = $element->hasChildren() || $element->getFrontendModel(); } return $isVisible; }
/** * Check whether element is visible * * @return bool */ public function isVisible() { if (parent::isVisible()) { return $this->hasChildren() || $this->getFrontendModel(); } return false; }
/** * Check a configuration element visibility * * @param \Magento\Config\Model\Config\Structure\AbstractElement $element The config composite element * @param string $scope The element scope * * @return bool */ public function isVisible(\Magento\Config\Model\Config\Structure\AbstractElement $element, $scope) { if ($element->getAttribute('if_module_enabled') && !$this->moduleManager->isOutputEnabled($element->getAttribute('if_module_enabled'))) { return false; } $showInScope = [ContainerScopeInterface::SCOPE_DEFAULT => $element->getAttribute('showInDefault'), ContainerScopeInterface::SCOPE_CONTAINERS => $element->getAttribute('showInContainer'), ContainerScopeInterface::SCOPE_STORE_CONTAINERS => $element->getAttribute('showInStore')]; if ($this->storeManager->isSingleStoreMode()) { $result = !$element->getAttribute('hide_in_single_store_mode') && array_sum($showInScope); return $result; } return !empty($showInScope[$scope]); }
public function testGetPathBuildsFullPath() { $this->_model->setData(['path' => 'section/group', 'id' => 'fieldId'], 'scope'); $this->assertEquals('section/group/prefix_fieldId', $this->_model->getPath('prefix_')); }
/** * Initialize current flyweight * * @param array $element * @return void */ protected function _initFlyweight(array $element) { $this->_flyweight->setData($element, $this->_scope); }
/** * Retrieve comment * * @param string $currentValue * @return string */ public function getComment($currentValue = '') { $comment = ''; if (isset($this->_data['comment'])) { if (is_array($this->_data['comment'])) { if (isset($this->_data['comment']['model'])) { $model = $this->_commentFactory->create($this->_data['comment']['model']); $comment = $model->getCommentText($currentValue); } } else { $comment = parent::getComment(); } } return $comment; }