site = $site; $this->languageId = $languageId; $this->locale = $locale; $this->base = $base; $this->attributes = $attributes; if (!empty($attributes['title'])) { $this->title = $attributes['title']; } if (!empty($attributes['navigationTitle'])) { $this->navigationTitle = $attributes['navigationTitle']; } if (!empty($attributes['flag'])) { $this->flagIdentifier = $attributes['flag']; } if (!empty($attributes['typo3Language'])) { $this->typo3Language = $attributes['typo3Language']; } if (!empty($attributes['iso-639-1'])) { $this->twoLetterIsoCode = $attributes['iso-639-1']; } if (!empty($attributes['hreflang'])) { $this->hreflang = $attributes['hreflang']; } if (!empty($attributes['direction'])) { $this->direction = $attributes['direction']; } if (!empty($attributes['fallbackType'])) { $this->fallbackType = $attributes['fallbackType']; } if (!empty($attributes['fallbacks'])) { $this->fallbackLanguageIds = $attributes['fallbacks']; } } /** * Returns the SiteLanguage in an array representation for e.g. the usage * in TypoScript. * * @return array */ public function toArray(): array { return [ 'languageId' => $this->getLanguageId(), 'locale' => $this->getLocale(), 'base' => $this->getBase(), 'title' => $this->getTitle(), 'navigationTitle' => $this->getNavigationTitle(), 'twoLetterIsoCode' => $this->getTwoLetterIsoCode(), 'hreflang' => $this->getHreflang(), 'direction' => $this->getDirection(), 'typo3Language' => $this->getTypo3Language(), 'flagIdentifier' => $this->getFlagIdentifier(), 'fallbackType' => $this->getFallbackType(), 'fallbackLanguageIds' => $this->getFallbackLanguageIds(), ]; } /** * @return Site */ public function getSite(): Site { return $this->site; } /** * @return int */ public function getLanguageId(): int { return $this->languageId; } /** * @return string */ public function getLocale(): string { return $this->locale; } /** * @return string */ public function getBase(): string { return $this->base; } /** * @return string */ public function getTitle(): string { return $this->title; } /** * @return string */ public function getNavigationTitle(): string { return $this->navigationTitle ?: $this->getTitle(); } /** * @return string */ public function getFlagIdentifier(): string { return $this->flagIdentifier; } /** * @return string */ public function getTypo3Language(): string { return $this->typo3Language; } /** * Returns the ISO-639-1 language ISO code * * @return string */ public function getTwoLetterIsoCode(): string { return $this->twoLetterIsoCode; } /** * Returns the RFC 1766 / 3066 language tag * * @return string */ public function getHreflang(): string { return $this->hreflang; } /** * Returns the language direction * * @return string */ public function getDirection(): string { return $this->direction; } /** * @return string */ public function getFallbackType(): string { return $this->fallbackType; } /** * @return array */ public function getFallbackLanguageIds(): array { return $this->fallbackLanguageIds; } }