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) |
return | string |
public function getTranslatedContentName(Content $content, $forcedLanguage = null)
{
return $this->getTranslatedContentNameByVersionInfo($content->getVersionInfo(), $forcedLanguage);
}
/** * @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); }