eZ\Publish\Core\Helper\TranslationHelper::getTranslatedContentName PHP Метод

getTranslatedContentName() публичный Метод

By default this method uses prioritized languages, unless $forcedLanguage is provided.
public getTranslatedContentName ( eZ\Publish\API\Repository\Values\Content\Content $content, string $forcedLanguage = null ) : string
$content eZ\Publish\API\Repository\Values\Content\Content
$forcedLanguage string Locale we want the content name translation in (e.g. "fre-FR"). Null by default (takes current locale)
Результат string
    public function getTranslatedContentName(Content $content, $forcedLanguage = null)
    {
        return $this->getTranslatedContentNameByVersionInfo($content->getVersionInfo(), $forcedLanguage);
    }

Usage Example

Пример #1
0
 /**
  * @param \eZ\Publish\API\Repository\Values\ValueObject $content Must be a valid Content or ContentInfo object.
  * @param string $forcedLanguage Locale we want the content name translation in (e.g. "fre-FR"). Null by default (takes current locale)
  *
  * @throws \eZ\Publish\Core\Base\Exceptions\InvalidArgumentType When $content is not a valid Content or ContentInfo object.
  *
  * @return string
  */
 public function getTranslatedContentName(ValueObject $content, $forcedLanguage = null)
 {
     if ($content instanceof Content) {
         return $this->translationHelper->getTranslatedContentName($content, $forcedLanguage);
     } elseif ($content instanceof ContentInfo) {
         return $this->translationHelper->getTranslatedContentNameByContentInfo($content, $forcedLanguage);
     }
     throw new InvalidArgumentType('$content', 'eZ\\Publish\\API\\Repository\\Values\\Content\\Content or eZ\\Publish\\API\\Repository\\Values\\Content\\ContentInfo', $content);
 }
All Usage Examples Of eZ\Publish\Core\Helper\TranslationHelper::getTranslatedContentName