src/Contao/View/Contao2BackendView/ActionHandler/ShowHandler.php
protected function process(Action $action, EnvironmentInterface $environment)
    {
        if ($environment->getDataDefinition()->getBasicDefinition()->isEditOnlyMode()) {
            return $environment->getView()->edit($action);
        }

        $modelId      = ModelId::fromSerialized($environment->getInputProvider()->getParameter('id'));
        $dataProvider = $environment->getDataProvider($modelId->getDataProviderName());
        $translator   = $environment->getTranslator();
        $model        = $this->getModel($environment);
        $data         = $this->convertModel($model, $environment);

        $template = (new ContaoBackendViewTemplate('dcbe_general_show'))
            ->set('headline', $this->getHeadline($translator, $model))
            ->set('arrFields', $data['values'])
            ->set('arrLabels', $data['labels']);

        if ($dataProvider instanceof MultiLanguageDataProviderInterface) {
            $template
                ->set('languages', $environment->getController()->getSupportedLanguages($model->getId()))
                ->set('currentLanguage', $dataProvider->getCurrentLanguage())
                ->set('languageSubmit', $translator->translate('MSC.showSelected'))
                ->set('backBT', StringUtil::specialchars($translator->translate('MSC.backBT')));
        } else {
            $template->set('languages', null);
        }

        return $template->parse();
    }
protected function process(Action $action, EnvironmentInterface $environment)
    {
        if ($environment->getDataDefinition()->getBasicDefinition()->isEditOnlyMode()) {
            return $environment->getView()->edit($action);
        }

        $modelId      = ModelId::fromSerialized($environment->getInputProvider()->getParameter('id'));
        $dataProvider = $environment->getDataProvider($modelId->getDataProviderName());
        $translator   = $environment->getTranslator();
        $model        = $this->getModel($environment);
        $data         = $this->convertModel($model, $environment);

        $template = (new ContaoBackendViewTemplate('dcbe_general_show'))
            ->set('headline', $this->getHeadline($translator, $model))
            ->set('arrFields', $data['values'])
            ->set('arrLabels', $data['labels']);

        if ($dataProvider instanceof MultiLanguageDataProviderInterface) {
            $template
                ->set('languages', $environment->getController()->getSupportedLanguages($model->getId()))
                ->set('currentLanguage', $dataProvider->getCurrentLanguage())
                ->set('languageSubmit', $translator->translate('MSC.showSelected'))
                ->set('backBT', StringUtil::specialchars($translator->translate('MSC.backBT')));
        } else {
            $template->set('languages', null);
        }

        return $template->parse();
    }
protected function process ( Action $ action , EnvironmentInterface $ environment ) { if ( $ environment -> getDataDefinition ( ) -> getBasicDefinition ( ) -> isEditOnlyMode ( ) ) { return $ environment -> getView ( ) -> edit ( $ action ) ; } $ modelId = ModelId :: fromSerialized ( $ environment -> getInputProvider ( ) -> getParameter ( 'id' ) ) ; $ dataProvider = $ environment -> getDataProvider ( $ modelId -> getDataProviderName ( ) ) ; $ translator = $ environment -> getTranslator ( ) ; $ model = $ this -> getModel ( $ environment ) ; $ data = $ this -> convertModel ( $ model , $ environment ) ; $ template = ( new ContaoBackendViewTemplate ( 'dcbe_general_show' ) ) -> set ( 'headline' , $ this -> getHeadline ( $ translator , $ model ) ) -> set ( 'arrFields' , $ data [ 'values' ] ) -> set ( 'arrLabels' , $ data [ 'labels' ] ) ; if ( $ dataProvider instanceof MultiLanguageDataProviderInterface ) { $ template -> set ( 'languages' , $ environment -> getController ( ) -> getSupportedLanguages ( $ model -> getId ( ) ) ) -> set ( 'currentLanguage' , $ dataProvider -> getCurrentLanguage ( ) ) -> set ( 'languageSubmit' , $ translator -> translate ( 'MSC.showSelected' ) ) -> set ( 'backBT' , StringUtil :: specialchars ( $ translator -> translate ( 'MSC.backBT' ) ) ) ; } else { $ template -> set ( 'languages' , null ) ; } return $ template -> parse ( ) ; }
Handle the show event.

@param Action               $action      The action which is handled.
@param EnvironmentInterface $environment The environment.

@return string
Handle the show event .