protected function checkIfTranslationsExistInLanguage(
        array $contentElements,
        $language,
        PageLayoutView $parentObject
    ) {
        // If in default language, you may always create new entries
        // Also, you may override this strict behavior via user TS Config
        // If you do so, you're on your own and cannot rely on any support by the TYPO3 core
        // We jump out here since we don't need to do the expensive loop operations
        $allowInconsistentLanguageHandling = BackendUtility::getPagesTSconfig($parentObject->id)['mod.']['web_layout.']['allowInconsistentLanguageHandling'] ?? [];
        if ($language === 0 || $language === -1 || $allowInconsistentLanguageHandling['value'] === '1') {
            return false;
        }
        /**
         * Build up caches
         */
        if (!isset($this->languageHasTranslationsCache[$language])) {
            foreach ($contentElements as $contentElement) {
                if ((int)$contentElement['l18n_parent'] === 0) {
                    $this->languageHasTranslationsCache[$language]['hasStandAloneContent'] = true;
                }
                if ((int)$contentElement['l18n_parent'] > 0) {
                    $this->languageHasTranslationsCache[$language]['hasTranslations'] = true;
                }
            }
            // Check whether we have a mix of both
            if ($this->languageHasTranslationsCache[$language]['hasStandAloneContent']
                && $this->languageHasTranslationsCache[$language]['hasTranslations']
            ) {
                /** @var $message FlashMessage */
                $message = GeneralUtility::makeInstance(
                    FlashMessage::class,
                    sprintf(
                        $this->getLanguageService()->getLL('staleTranslationWarning'),
                        $parentObject->languageIconTitles[$language]['title']
                    ),
                    sprintf(
                        $this->getLanguageService()->getLL('staleTranslationWarningTitle'),
                        $parentObject->languageIconTitles[$language]['title']
                    ),
                    FlashMessage::WARNING
                );
                $service = GeneralUtility::makeInstance(FlashMessageService::class);
                /** @var $queue FlashMessageQueue */
                $queue = $service->getMessageQueueByIdentifier();
                $queue->enqueue($message);
            }
        }
        if ($this->languageHasTranslationsCache[$language]['hasTranslations']) {
            return true;
        }
        return false;
    }
protected function checkIfTranslationsExistInLanguage(
        array $contentElements,
        $language,
        PageLayoutView $parentObject
    ) {
        // If in default language, you may always create new entries
        // Also, you may override this strict behavior via user TS Config
        // If you do so, you're on your own and cannot rely on any support by the TYPO3 core
        // We jump out here since we don't need to do the expensive loop operations
        $allowInconsistentLanguageHandling = BackendUtility::getPagesTSconfig($parentObject->id)['mod.']['web_layout.']['allowInconsistentLanguageHandling'] ?? [];
        if ($language === 0 || $language === -1 || $allowInconsistentLanguageHandling['value'] === '1') {
            return false;
        }
        /**
         * Build up caches
         */
        if (!isset($this->languageHasTranslationsCache[$language])) {
            foreach ($contentElements as $contentElement) {
                if ((int)$contentElement['l18n_parent'] === 0) {
                    $this->languageHasTranslationsCache[$language]['hasStandAloneContent'] = true;
                }
                if ((int)$contentElement['l18n_parent'] > 0) {
                    $this->languageHasTranslationsCache[$language]['hasTranslations'] = true;
                }
            }
            // Check whether we have a mix of both
            if ($this->languageHasTranslationsCache[$language]['hasStandAloneContent']
                && $this->languageHasTranslationsCache[$language]['hasTranslations']
            ) {
                /** @var $message FlashMessage */
                $message = GeneralUtility::makeInstance(
                    FlashMessage::class,
                    sprintf(
                        $this->getLanguageService()->getLL('staleTranslationWarning'),
                        $parentObject->languageIconTitles[$language]['title']
                    ),
                    sprintf(
                        $this->getLanguageService()->getLL('staleTranslationWarningTitle'),
                        $parentObject->languageIconTitles[$language]['title']
                    ),
                    FlashMessage::WARNING
                );
                $service = GeneralUtility::makeInstance(FlashMessageService::class);
                /** @var $queue FlashMessageQueue */
                $queue = $service->getMessageQueueByIdentifier();
                $queue->enqueue($message);
            }
        }
        if ($this->languageHasTranslationsCache[$language]['hasTranslations']) {
            return true;
        }
        return false;
    }
protected function checkIfTranslationsExistInLanguage ( array $ contentElements , $ language , PageLayoutView $ parentObject ) { // If in default language, you may always create new entries // Also, you may override this strict behavior via user TS Config // If you do so, you're on your own and cannot rely on any support by the TYPO3 core // We jump out here since we don't need to do the expensive loop operations $ allowInconsistentLanguageHandling = BackendUtility :: getPagesTSconfig ( $ parentObject -> id ) [ 'mod.' ] [ 'web_layout.' ] [ 'allowInconsistentLanguageHandling' ] ?? [ ] ; if ( $ language === 0 || $ language === - 1 || $ allowInconsistentLanguageHandling [ 'value' ] === '1' ) { return false ; } /**
         * Build up caches
         */ if ( ! isset ( $ this -> languageHasTranslationsCache [ $ language ] ) ) { foreach ( $ contentElements as $ contentElement ) { if ( ( int ) $ contentElement [ 'l18n_parent' ] === 0 ) { $ this -> languageHasTranslationsCache [ $ language ] [ 'hasStandAloneContent' ] = true ; } if ( ( int ) $ contentElement [ 'l18n_parent' ] > 0 ) { $ this -> languageHasTranslationsCache [ $ language ] [ 'hasTranslations' ] = true ; } } // Check whether we have a mix of both if ( $ this -> languageHasTranslationsCache [ $ language ] [ 'hasStandAloneContent' ] && $ this -> languageHasTranslationsCache [ $ language ] [ 'hasTranslations' ] ) { /** @var $message FlashMessage */ $ message = GeneralUtility :: makeInstance ( FlashMessage :: class , sprintf ( $ this -> getLanguageService ( ) -> getLL ( 'staleTranslationWarning' ) , $ parentObject -> languageIconTitles [ $ language ] [ 'title' ] ) , sprintf ( $ this -> getLanguageService ( ) -> getLL ( 'staleTranslationWarningTitle' ) , $ parentObject -> languageIconTitles [ $ language ] [ 'title' ] ) , FlashMessage :: WARNING ) ; $ service = GeneralUtility :: makeInstance ( FlashMessageService :: class ) ; /** @var $queue FlashMessageQueue */ $ queue = $ service -> getMessageQueueByIdentifier ( ) ; $ queue -> enqueue ( $ message ) ; } } if ( $ this -> languageHasTranslationsCache [ $ language ] [ 'hasTranslations' ] ) { return true ; } return false ; }
Checks whether translated Content Elements exist in the desired language
If so, deny creating new ones via the UI

@param array $contentElements
@param int $language
@param PageLayoutView $parentObject

@return bool
@throws \TYPO3\CMS\Core\Exception
Checks whether translated Content Elements exist in the desired language If so deny creating new ones via the UI