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
338590
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;
    }
1155604
protected function buildContentTranslateView(array $viewConfig): ContentTranslateView
    {
        $view = new ContentTranslateView();
        $view->setConfigHash($viewConfig);
        if (isset($viewConfig['template'])) {
            $view->setTemplateIdentifier($viewConfig['template']);
        }
        if (isset($viewConfig['controller'])) {
            $view->setControllerReference(new ControllerReference($viewConfig['controller']));
        }
        if (isset($viewConfig['params']) && is_array($viewConfig['params'])) {
            $view->addParameters($viewConfig['params']);
        }

        return $view;
    }
114890
public function toXML(DOMNode $parentElement = null) : DOMElement
    {
        if ($parentElement === null) {
            $document = DOMDocumentFactory::create();
            $parentElement = $document;
        } else {
            $document = $parentElement->ownerDocument;
        }

        $root = $document->createElementNS(Constants::NS_SAML, 'saml:'.'EncryptedAssertion');
        $parentElement->appendChild($root);

        $root->appendChild($document->importNode($this->encryptedData, true));

        return $root;
    }
349705
function initializeObjectAttribute( $contentObjectAttribute, $currentVersion, $originalContentObjectAttribute )
    {
        if ( $currentVersion != false )
        {
            $contentObjectID = $contentObjectAttribute->attribute( 'contentobject_id' );
            $originalContentObjectID = $originalContentObjectAttribute->attribute( 'contentobject_id' );
            $languageMask = $contentObjectAttribute->attribute( 'language_id' ) & ~1;
            $originalLanguageMask = $originalContentObjectAttribute->attribute( 'language_id' ) & ~1;

            // Case when content object was copied or when new translation has been added to the existing one
            if ( ( $contentObjectID != $originalContentObjectID )
                    || ( ( $contentObjectID == $originalContentObjectID )
                       && ( $languageMask != $originalLanguageMask )
                            && ( $contentObjectAttribute->attribute( 'can_translate' ) ) ) )
            {
                $page = $originalContentObjectAttribute->content();
                $clonedPage = clone $page;
                $contentObjectAttribute->setContent( $clonedPage );
                $contentObjectAttribute->store();
            }
            else
            {
                $dataText = $originalContentObjectAttribute->attribute( 'data_text' );
                $contentObjectAttribute->setAttribute( 'data_text', $dataText );
            }
        }
        else
        {
            $contentClassAttribute = $contentObjectAttribute->contentClassAttribute();
            $defaultLayout = $contentClassAttribute->attribute( self::DEFAULT_ZONE_LAYOUT_FIELD );
            $zoneINI = eZINI::instance( 'zone.ini' );
            $page = new eZPage();
            $zones = array();
            if ( $defaultLayout !== '' )
            {
                if ( $zoneINI->hasVariable( $defaultLayout, 'Zones' ) )
                    $zones = $zoneINI->variable( $defaultLayout, 'Zones' );

                $page->setAttribute( 'zone_layout', $defaultLayout );
                foreach ( $zones as $zoneIdentifier )
                {
                    $newZone = $page->addZone( new eZPageZone() );
                    $newZone->setAttribute( 'id', md5( mt_rand() . microtime() . $page->getZoneCount() ) );
                    $newZone->setAttribute( 'zone_identifier', $zoneIdentifier );
                    $newZone->setAttribute( 'action', 'add' );
                }
            }
            else
            {
                $allowedZones = array();
                if ( $zoneINI->hasGroup( 'General' ) && $zoneINI->hasVariable( 'General', 'AllowedTypes' ) )
                    $allowedZones = $zoneINI->variable( 'General', 'AllowedTypes' );

                $class = eZContentClass::fetch( $contentClassAttribute->attribute( 'contentclass_id' ) );

                foreach ( $allowedZones as $allowedZone )
                {
                    $availableForClasses = array();
                    if ( $zoneINI->hasVariable( $allowedZone, 'AvailableForClasses' ) )
                        $availableForClasses = $zoneINI->variable( $allowedZone, 'AvailableForClasses' );

                    if ( in_array( $class->attribute( 'identifier' ), $availableForClasses ) )
                    {
                        if ( $zoneINI->hasVariable( $allowedZone, 'Zones' ) )
                            $zones = $zoneINI->variable( $allowedZone, 'Zones' );

                        $page->setAttribute( 'zone_layout', $allowedZone );
                        foreach ( $zones as $zoneIdentifier )
                        {
                            $newZone = $page->addZone( new eZPageZone() );
                            $newZone->setAttribute( 'id', md5( mt_rand() . microtime() . $page->getZoneCount() ) );
                            $newZone->setAttribute( 'zone_identifier', $zoneIdentifier );
                            $newZone->setAttribute( 'action', 'add' );
                        }

                        break;
                    }
                    else
                        continue;
                }
            }
            $contentObjectAttribute->setContent( $page );
        }
    }
1078485
public static function buildBreadcrumbs(Content $content, Language $language)
    {
        resolve('breadcrumbs')->register(
            $content->type->name,
            function ($breadcrumbs) use ($content, $language) {
                $breadcrumbs->push(trans('gzero-core::common.home'), routeMl('home'));

                $titlesAndUrls = (new ContentReadRepository)->getAncestorsTitlesAndPaths($content, $language);

                $titlesAndUrls->each(function ($item) use ($breadcrumbs, $language) {
                    $breadcrumbs->push($item->title, urlMl($item->path, $language->code));
                });
            }
        );
    }
1159382
private function getParentNode($parent, $webspaceKey, $languageCode)
    {
        if (null != $parent) {
            return $this->getMapper()->load($parent, $webspaceKey, $languageCode);
        } else {
            return $this->getMapper()->loadStartPage($webspaceKey, $languageCode);
        }
    }
423734
public function toXML(DOMElement $parent) : DOMElement
    {
        Assert::notEmpty($this->lang, "Cannot convert Keywords to XML without a language set.");

        $doc = $parent->ownerDocument;

        $e = $doc->createElementNS(Common::NS, 'mdui:Keywords');
        $e->setAttribute('xml:lang', $this->lang);
        $value = '';
        foreach ($this->Keywords as $keyword) {
            if (strpos($keyword, "+") !== false) {
                throw new \Exception('Keywords may not contain a "+" character.');
            }
            $value .= str_replace(' ', '+', $keyword).' ';
        }
        $value = rtrim($value);
        $e->appendChild($doc->createTextNode($value));
        $parent->appendChild($e);

        return $e;
    }
734855
public function getChildrenQueryBuilder(Node $parent, $lang = null)
    {
        return $this->getNodeTranslationsQueryBuilder($lang)
            ->andWhere('n.parent = :parent')
            ->setParameter('parent', $parent);
    }
1219286
public function validateParentContentElement($attribute)
    {
        if (!$this->cmsContent) {
            return false;
        }

        if (!$this->cmsContent->parentContent) {
            return false;
        }

        if ($this->$attribute) {
            $contentElement = static::findOne($this->$attribute);
            if ($contentElement->cmsContent->id != $this->cmsContent->parentContent->id) {
                $this->addError($attribute,
                    \Yii::t('skeeks/cms', 'The parent must be a content element: «{contentName}».',
                        ['contentName' => $this->cmsContent->parentContent->name]));
            }
        }
    }
1187134
private static function createTypeElement(\DOMDocument $document, $parentElement = null, $type)
    {
        if ($parentElement->parentNode === null) {
            $typeElement = $document->createElementNS(
                'https://github.com/RhubarbPHP/Rhubarb/blob/master/docs/simple-xml-transcoder.md',
                self::XMLNS . ':' . $type
            );
            $parentElement->appendChild($typeElement);
        } else {
            $parentElement->setAttribute(self::XMLNS . ':' . self::ATTR_TYPE, $type);
            $typeElement = $parentElement;
        }

        return $typeElement;
    }
139609
public function preProcess(PageLayoutView &$parentObject, &$info, array &$row)
    {
        if ($this->skipRendering($parentObject, $row)) {
            return;
        }

        $renderer = GeneralUtility::makeInstance(ColumnRenderer::class, $row);

        if (!$renderer->skipRendering()) {
            list($html, $css) = $renderer->renderSingleColumn();

            $info[] = $html;
            $this->inlineStyles[] = $css;
        }

        return;
    }
909599
public function toXML(\DOMNode $parentElement = null) : DOMElement
    {
        if ($parentElement === null) {
            $document = DOMDocumentFactory::create();
            $parentElement = $document;
        } else {
            $document = $parentElement->ownerDocument;
        }

        $root = $document->createElementNS(Constants::NS_SAML, 'saml:'.'Assertion');
        $parentElement->appendChild($root);

        /* Ugly hack to add another namespace declaration to the root element. */
        $root->setAttributeNS(Constants::NS_SAMLP, 'samlp:tmp', 'tmp');
        $root->removeAttributeNS(Constants::NS_SAMLP, 'tmp');
        $root->setAttributeNS(Constants::NS_XSI, 'xsi:tmp', 'tmp');
        $root->removeAttributeNS(Constants::NS_XSI, 'tmp');
        $root->setAttributeNS(Constants::NS_XS, 'xs:tmp', 'tmp');
        $root->removeAttributeNS(Constants::NS_XS, 'tmp');

        $root->setAttribute('ID', $this->id);
        $root->setAttribute('Version', '2.0');
        $root->setAttribute('IssueInstant', gmdate('Y-m-d\TH:i:s\Z', $this->issueInstant));

        $issuer = $this->issuer->toXML($root);

        $this->addSubject($root);
        $this->addConditions($root);
        $this->addAuthnStatement($root);
        if ($this->getRequiredEncAttributes() === false) {
            $this->addAttributeStatement($root);
        } else {
            $this->addEncryptedAttributeStatement($root);
        }

        if ($this->signatureKey !== null) {
            Utils::insertSignature($this->signatureKey, $this->certificates, $root, $issuer->nextSibling);
        }

        return $root;
    }
1334118
public function getFullTagDataByKeywordAndParentId($keyword, $parentId, array $translations = null, $useAlwaysAvailable = true)
    {
        $query = $this->createTagFindQuery($translations, $useAlwaysAvailable);
        $query->where(
            $query->expr->eq(
                $this->handler->quoteColumn('keyword', 'eztags_keyword'),
                $query->bindValue($keyword, null, PDO::PARAM_STR)
            ),
            $query->expr->eq(
                $this->handler->quoteColumn('parent_id', 'eztags'),
                $query->bindValue($parentId, null, PDO::PARAM_INT)
            )
        );

        $statement = $query->prepare();
        $statement->execute();

        return $statement->fetchAll(PDO::FETCH_ASSOC);
    }
1046414
private function createMainLanguageUpdateForm(Content $content, string $languageCode): FormInterface
    {
        $data = new MainTranslationUpdateData($content, $languageCode);

        return $this->formFactory->create(MainTranslationUpdateType::class, $data);
    }
463316
protected function locateDataObject(SimpleXMLElement $element, CNabuDataObject $data_parent = null) : bool
    {
        $retval = false;
        
        if (isset($element['GUID'])) {
            $guid = (string)$element['GUID'];
            if (!($this->nb_data_object instanceof CNabuSiteTargetLanguageList)) {
                $this->nb_data_object = CNabuSiteTargetLanguageList::findByHash($guid);
            } else {
                $this->nb_data_object = null;
            }
        
            if (!($this->nb_data_object instanceof CNabuSiteTargetLanguageList)) {
                $this->nb_data_object = new CNabuSiteTargetLanguageList();
                $this->nb_data_object->setHash($guid);
            }
            $retval = true;
        }
        
        return $retval;
    }
580961
public function createContent($contentType, $fields, $parentLocationId)
    {
        $repository = $this->getRepository();
        $languageCode = self::DEFAULT_LANGUAGE;
        $content = $this->createContentDraft($parentLocationId, $contentType, $fields, $languageCode);
        $content = $this->contentService->publishVersion($content->versionInfo);

        return $content->contentInfo->mainLocationId;
    }
1132052
protected void initBodyElementLanguage() {

        List<Locale> locales = m_page.getLocales();
        Locale defaultLocale = OpenCms.getLocaleManager().getDefaultLocales(getCms(), getCms().getSitePath(m_file)).get(
            0);

        if (locales.size() == 0) {
            // no body present, create default body
            if (!m_page.hasValue(CmsDefaultPageEditor.XML_BODY_ELEMENT, defaultLocale)) {
                m_page.addValue(CmsDefaultPageEditor.XML_BODY_ELEMENT, defaultLocale);
            }
            try {
                m_file.setContents(m_page.marshal());
                getCms().writeFile(m_file);
            } catch (CmsException e) {
                // show error page
                try {
                    showErrorPage(this, e);
                } catch (JspException exc) {
                    // should usually never happen
                    if (LOG.isInfoEnabled()) {
                        LOG.info(exc);
                    }
                }
            }
            setParamElementlanguage(defaultLocale.toString());
        } else {
            // body present, get the language
            if (locales.contains(defaultLocale)) {
                // get the body for the default language
                setParamElementlanguage(defaultLocale.toString());
            } else {
                // get the first body that can be found
                setParamElementlanguage(locales.get(0).toString());
            }

        }
    }