src/ViewCombination/InputScreenInformationBuilder.php
private function convertLegends(array $properties, IMetaModel $metaModel, array $conditions): array
    {
        $result = [];
        $label  = [];
        if ($trans = $metaModel->isTranslated()) {
            foreach ($metaModel->getAvailableLanguages() as $availableLanguage) {
                $label[$availableLanguage] = $metaModel->getName();
            }
        } else {
            $label[$metaModel->getActiveLanguage()] = $metaModel->getName();
        }

        $legend = [
            'label'      => $label,
            'hide'       => false,
            'properties' => []
        ];

        $condition = function ($property) use ($conditions) {
            if (!isset($conditions[$property['id']])) {
                return null;
            }

            return [
                'type'     => 'conditionand',
                'children' => $conditions[$property['id']]
            ];
        };

        foreach ($properties as $property) {
            switch ($property['dcatype']) {
                case 'legend':
                    $this->convertLegend($property, $trans, $condition, $legend, $result);
                    break;
                case 'attribute':
                    $this->convertAttribute($property, $condition, $legend);
                    break;
                default:
                    break;
            }
        }
        if (!empty($legend['properties'])) {
            $result['legend' . (\count($result) + 1)] = $legend;
        }

        return $result;
    }
private function convertLegends(array $properties, IMetaModel $metaModel, array $conditions): array
    {
        $result = [];
        $label  = [];
        if ($trans = $metaModel->isTranslated()) {
            foreach ($metaModel->getAvailableLanguages() as $availableLanguage) {
                $label[$availableLanguage] = $metaModel->getName();
            }
        } else {
            $label[$metaModel->getActiveLanguage()] = $metaModel->getName();
        }

        $legend = [
            'label'      => $label,
            'hide'       => false,
            'properties' => []
        ];

        $condition = function ($property) use ($conditions) {
            if (!isset($conditions[$property['id']])) {
                return null;
            }

            return [
                'type'     => 'conditionand',
                'children' => $conditions[$property['id']]
            ];
        };

        foreach ($properties as $property) {
            switch ($property['dcatype']) {
                case 'legend':
                    $this->convertLegend($property, $trans, $condition, $legend, $result);
                    break;
                case 'attribute':
                    $this->convertAttribute($property, $condition, $legend);
                    break;
                default:
                    break;
            }
        }
        if (!empty($legend['properties'])) {
            $result['legend' . (\count($result) + 1)] = $legend;
        }

        return $result;
    }
private function convertLegends ( array $ properties , IMetaModel $ metaModel , array $ conditions ) : array { $ result = [ ] ; $ label = [ ] ; if ( $ trans = $ metaModel -> isTranslated ( ) ) { foreach ( $ metaModel -> getAvailableLanguages ( ) as $ availableLanguage ) { $ label [ $ availableLanguage ] = $ metaModel -> getName ( ) ; } } else { $ label [ $ metaModel -> getActiveLanguage ( ) ] = $ metaModel -> getName ( ) ; } $ legend = [ 'label' => $ label , 'hide' => false , 'properties' => [ ] ] ; $ condition = function ( $ property ) use ( $ conditions ) { if ( ! isset ( $ conditions [ $ property [ 'id' ] ] ) ) { return null ; } return [ 'type' => 'conditionand' , 'children' => $ conditions [ $ property [ 'id' ] ] ] ; } ; foreach ( $ properties as $ property ) { switch ( $ property [ 'dcatype' ] ) { case 'legend' : $ this -> convertLegend ( $ property , $ trans , $ condition , $ legend , $ result ) ; break ; case 'attribute' : $ this -> convertAttribute ( $ property , $ condition , $ legend ) ; break ; default : break ; } } if ( ! empty ( $ legend [ 'properties' ] ) ) { $ result [ 'legend' . ( \ count ( $ result ) + 1 ) ] = $ legend ; } return $ result ; }
Convert property list to legend list.

@param array      $properties The property and legend information.
@param IMetaModel $metaModel  The MetaModel to fetch properties for.

@param array      $conditions The conditions for the entries.

@return array
Convert property list to legend list .