src/Contao/View/Contao2BackendView/ActionHandler/ShowHandler.php
protected function convertModel($model, $environment)
    {
        $definition = $environment->getDataDefinition();
        $properties = $definition->getPropertiesDefinition();
        $palette    = $definition->getPalettesDefinition()->findPalette($model);
        $values     = [];
        $labels     = [];
        // Show only allowed fields.
        foreach ($palette->getVisibleProperties($model) as $paletteProperty) {
            if (!($property = $properties->getProperty($paletteProperty->getName()))) {
                throw new DcGeneralRuntimeException('Unable to retrieve property ' . $paletteProperty->getName());
            }

            // Make it human readable.
            $values[$paletteProperty->getName()] = ViewHelpers::getReadableFieldValue(
                $environment,
                $property,
                $model
            );

            $labels[$paletteProperty->getName()] = $this->getPropertyLabel($environment, $property);
        }

        return [
            'labels' => $labels,
            'values' => $values
        ];
    }
protected function convertModel($model, $environment)
    {
        $definition = $environment->getDataDefinition();
        $properties = $definition->getPropertiesDefinition();
        $palette    = $definition->getPalettesDefinition()->findPalette($model);
        $values     = [];
        $labels     = [];
        // Show only allowed fields.
        foreach ($palette->getVisibleProperties($model) as $paletteProperty) {
            if (!($property = $properties->getProperty($paletteProperty->getName()))) {
                throw new DcGeneralRuntimeException('Unable to retrieve property ' . $paletteProperty->getName());
            }

            // Make it human readable.
            $values[$paletteProperty->getName()] = ViewHelpers::getReadableFieldValue(
                $environment,
                $property,
                $model
            );

            $labels[$paletteProperty->getName()] = $this->getPropertyLabel($environment, $property);
        }

        return [
            'labels' => $labels,
            'values' => $values
        ];
    }
protected function convertModel ( $ model , $ environment ) { $ definition = $ environment -> getDataDefinition ( ) ; $ properties = $ definition -> getPropertiesDefinition ( ) ; $ palette = $ definition -> getPalettesDefinition ( ) -> findPalette ( $ model ) ; $ values = [ ] ; $ labels = [ ] ; // Show only allowed fields. foreach ( $ palette -> getVisibleProperties ( $ model ) as $ paletteProperty ) { if ( ! ( $ property = $ properties -> getProperty ( $ paletteProperty -> getName ( ) ) ) ) { throw new DcGeneralRuntimeException ( 'Unable to retrieve property ' . $ paletteProperty -> getName ( ) ) ; } // Make it human readable. $ values [ $ paletteProperty -> getName ( ) ] = ViewHelpers :: getReadableFieldValue ( $ environment , $ property , $ model ) ; $ labels [ $ paletteProperty -> getName ( ) ] = $ this -> getPropertyLabel ( $ environment , $ property ) ; } return [ 'labels' => $ labels , 'values' => $ values ] ; }
Convert a model to it's labels and human readable values.

@param ModelInterface       $model       The model to display.
@param EnvironmentInterface $environment The environment.

@return array

@throws DcGeneralRuntimeException When a property could not be retrieved.
Convert a model to it s labels and human readable values .