public function getReadableValue(RenderReadablePropertyValueEvent $event)
    {
        $environment = $event->getEnvironment();
        /** @var IMetaModelDataDefinition $definition */
        $definition = $environment->getDataDefinition();

        /** @var Model $model */
        $model = $event->getModel();

        if (!($model instanceof Model)) {
            return;
        }

        $nativeItem = $model->getItem();
        $metaModel  = $nativeItem->getMetaModel();

        $renderSetting = $this->renderSettingFactory->createCollection(
            $metaModel,
            $definition->getMetaModelDefinition()->getActiveRenderSetting()
        );

        if (!$renderSetting) {
            return;
        }

        $result = $nativeItem->parseAttribute($event->getProperty()->getName(), 'text', $renderSetting);

        if (!isset($result['text'])) {
            $event->setRendered(
                sprintf(
                    'Unexpected behaviour, attribute %s text representation was not rendered.',
                    $event->getProperty()->getName()
                )
            );
            return;
        }

        $event->setRendered($result['text']);
    }
public function getReadableValue(RenderReadablePropertyValueEvent $event)
    {
        $environment = $event->getEnvironment();
        /** @var IMetaModelDataDefinition $definition */
        $definition = $environment->getDataDefinition();

        /** @var Model $model */
        $model = $event->getModel();

        if (!($model instanceof Model)) {
            return;
        }

        $nativeItem = $model->getItem();
        $metaModel  = $nativeItem->getMetaModel();

        $renderSetting = $this->renderSettingFactory->createCollection(
            $metaModel,
            $definition->getMetaModelDefinition()->getActiveRenderSetting()
        );

        if (!$renderSetting) {
            return;
        }

        $result = $nativeItem->parseAttribute($event->getProperty()->getName(), 'text', $renderSetting);

        if (!isset($result['text'])) {
            $event->setRendered(
                sprintf(
                    'Unexpected behaviour, attribute %s text representation was not rendered.',
                    $event->getProperty()->getName()
                )
            );
            return;
        }

        $event->setRendered($result['text']);
    }
public function getReadableValue ( RenderReadablePropertyValueEvent $ event ) { $ environment = $ event -> getEnvironment ( ) ; /** @var IMetaModelDataDefinition $definition */ $ definition = $ environment -> getDataDefinition ( ) ; /** @var Model $model */ $ model = $ event -> getModel ( ) ; if ( ! ( $ model instanceof Model ) ) { return ; } $ nativeItem = $ model -> getItem ( ) ; $ metaModel = $ nativeItem -> getMetaModel ( ) ; $ renderSetting = $ this -> renderSettingFactory -> createCollection ( $ metaModel , $ definition -> getMetaModelDefinition ( ) -> getActiveRenderSetting ( ) ) ; if ( ! $ renderSetting ) { return ; } $ result = $ nativeItem -> parseAttribute ( $ event -> getProperty ( ) -> getName ( ) , 'text' , $ renderSetting ) ; if ( ! isset ( $ result [ 'text' ] ) ) { $ event -> setRendered ( sprintf ( 'Unexpected behaviour, attribute %s text representation was not rendered.' , $ event -> getProperty ( ) -> getName ( ) ) ) ; return ; } $ event -> setRendered ( $ result [ 'text' ] ) ; }
Render a model for use in a group header.

@param RenderReadablePropertyValueEvent $event The event.

@return void
Render a model for use in a group header .