public function performReadonlyTransformation()
    {
        $field = $this;

        if (!$this->readonly) {
            $field = parent::performReadonlyTransformation();

            $field->setTemplate(CompositeField::class);
            $field->setTitle('Title');

            $field->replaceField('Title', LiteralField::create(
                'Title',
                $field->fieldByName('Title')->Value()
            ));

            $displayedText = _t(__CLASS__ . '.DISPLAYED', 'Displayed');
            $notDisplayedText = _t(__CLASS__ . '.NOT_DISPLAYED', 'Not displayed');

            $field->replaceField('ShowTitle', LiteralField::create(
                'ShowTitle',
                $field->fieldByName('ShowTitle')->Value() === 'Yes' ? $displayedText : $notDisplayedText
            )->addExtraClass('show-title'));
        }

        return $field;
    }
public function performReadonlyTransformation()
    {
        $field = $this;

        if (!$this->readonly) {
            $field = parent::performReadonlyTransformation();

            $field->setTemplate(CompositeField::class);
            $field->setTitle('Title');

            $field->replaceField('Title', LiteralField::create(
                'Title',
                $field->fieldByName('Title')->Value()
            ));

            $displayedText = _t(__CLASS__ . '.DISPLAYED', 'Displayed');
            $notDisplayedText = _t(__CLASS__ . '.NOT_DISPLAYED', 'Not displayed');

            $field->replaceField('ShowTitle', LiteralField::create(
                'ShowTitle',
                $field->fieldByName('ShowTitle')->Value() === 'Yes' ? $displayedText : $notDisplayedText
            )->addExtraClass('show-title'));
        }

        return $field;
    }
public function performReadonlyTransformation ( ) { $ field = $ this ; if ( ! $ this -> readonly ) { $ field = parent :: performReadonlyTransformation ( ) ; $ field -> setTemplate ( CompositeField :: class ) ; $ field -> setTitle ( 'Title' ) ; $ field -> replaceField ( 'Title' , LiteralField :: create ( 'Title' , $ field -> fieldByName ( 'Title' ) -> Value ( ) ) ) ; $ displayedText = _t ( __CLASS__ . '.DISPLAYED' , 'Displayed' ) ; $ notDisplayedText = _t ( __CLASS__ . '.NOT_DISPLAYED' , 'Not displayed' ) ; $ field -> replaceField ( 'ShowTitle' , LiteralField :: create ( 'ShowTitle' , $ field -> fieldByName ( 'ShowTitle' ) -> Value ( ) === 'Yes' ? $ displayedText : $ notDisplayedText ) -> addExtraClass ( 'show-title' ) ) ; } return $ field ; }
Don't use the custom template for readonly states

{@inheritDoc}
Don t use the custom template for readonly states