Smile\ElasticsuiteCore\Model\Search\Request\RelevanceConfig\Structure\Element\Visibility::isVisible PHP Method

isVisible() public method

Check a configuration element visibility
public isVisible ( Magento\Config\Model\Config\Structure\AbstractElement $element, string $scope ) : boolean
$element Magento\Config\Model\Config\Structure\AbstractElement The config composite element
$scope string The element scope
return boolean
    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]);
    }

Usage Example

Exemplo n.º 1
0
 /**
  * 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;
 }
All Usage Examples Of Smile\ElasticsuiteCore\Model\Search\Request\RelevanceConfig\Structure\Element\Visibility::isVisible