src/Contao/View/Contao2BackendView/Subscriber/GetGroupHeaderSubscriber.php
protected function formatGroupHeader(
        EnvironmentInterface $environment,
        ModelInterface $model,
        PropertyInterface $property,
        $groupingMode,
        $groupingLength
    ) {
        $evaluation = $property->getExtra();

        if (!$evaluation['multiple'] && ('checkbox' === $property->getWidgetType())) {
            return $this->formatCheckboxOptionLabel($model->getProperty($property->getName()));
        }
        if (GroupAndSortingInformationInterface::GROUP_NONE !== $groupingMode) {
            return $this->formatByGroupingMode($groupingMode, $groupingLength, $environment, $property, $model);
        }

        $value = ViewHelpers::getReadableFieldValue($environment, $property, $model);

        if (isset($evaluation['reference'])) {
            $remoteNew = $evaluation['reference'][$value];
        } elseif (\array_is_assoc($property->getOptions())) {
            $options   = $property->getOptions();
            $remoteNew = $options[$value];
        } else {
            $remoteNew = $value;
        }

        if (\is_array($remoteNew)) {
            $remoteNew = $remoteNew[0];
        }

        if (empty($remoteNew)) {
            $remoteNew = '-';
        }

        return $remoteNew;
    }
protected function formatGroupHeader(
        EnvironmentInterface $environment,
        ModelInterface $model,
        PropertyInterface $property,
        $groupingMode,
        $groupingLength
    ) {
        $evaluation = $property->getExtra();

        if (!$evaluation['multiple'] && ('checkbox' === $property->getWidgetType())) {
            return $this->formatCheckboxOptionLabel($model->getProperty($property->getName()));
        }
        if (GroupAndSortingInformationInterface::GROUP_NONE !== $groupingMode) {
            return $this->formatByGroupingMode($groupingMode, $groupingLength, $environment, $property, $model);
        }

        $value = ViewHelpers::getReadableFieldValue($environment, $property, $model);

        if (isset($evaluation['reference'])) {
            $remoteNew = $evaluation['reference'][$value];
        } elseif (\array_is_assoc($property->getOptions())) {
            $options   = $property->getOptions();
            $remoteNew = $options[$value];
        } else {
            $remoteNew = $value;
        }

        if (\is_array($remoteNew)) {
            $remoteNew = $remoteNew[0];
        }

        if (empty($remoteNew)) {
            $remoteNew = '-';
        }

        return $remoteNew;
    }
protected function formatGroupHeader ( EnvironmentInterface $ environment , ModelInterface $ model , PropertyInterface $ property , $ groupingMode , $ groupingLength ) { $ evaluation = $ property -> getExtra ( ) ; if ( ! $ evaluation [ 'multiple' ] && ( 'checkbox' === $ property -> getWidgetType ( ) ) ) { return $ this -> formatCheckboxOptionLabel ( $ model -> getProperty ( $ property -> getName ( ) ) ) ; } if ( GroupAndSortingInformationInterface :: GROUP_NONE !== $ groupingMode ) { return $ this -> formatByGroupingMode ( $ groupingMode , $ groupingLength , $ environment , $ property , $ model ) ; } $ value = ViewHelpers :: getReadableFieldValue ( $ environment , $ property , $ model ) ; if ( isset ( $ evaluation [ 'reference' ] ) ) { $ remoteNew = $ evaluation [ 'reference' ] [ $ value ] ; } elseif ( \ array_is_assoc ( $ property -> getOptions ( ) ) ) { $ options = $ property -> getOptions ( ) ; $ remoteNew = $ options [ $ value ] ; } else { $ remoteNew = $ value ; } if ( \ is_array ( $ remoteNew ) ) { $ remoteNew = $ remoteNew [ 0 ] ; } if ( empty ( $ remoteNew ) ) { $ remoteNew = '-' ; } return $ remoteNew ; }
Get the group header.

@param EnvironmentInterface $environment    The environment.
@param ModelInterface       $model          The model.
@param PropertyInterface    $property       The property.
@param int                  $groupingMode   The grouping mode.
@param int                  $groupingLength The grouping length.

@return string
Get the group header .