Ojs\JournalBundle\Entity\BlockTranslation::setContent PHP Метод

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

public setContent ( string $content )
$content string
    public function setContent($content)
    {
        $this->content = $content;
        return $this;
    }

Usage Example

Пример #1
0
Файл: Block.php Проект: ojs/ojs
 /**
  * Translation helper method
  * @param null $locale
  * @return mixed|null|\Ojs\JournalBundle\Entity\BlockTranslation
  */
 public function translate($locale = null)
 {
     if (null === $locale) {
         $locale = $this->currentLocale;
     }
     if (!$locale) {
         throw new \RuntimeException('No locale has been set and currentLocale is empty');
     }
     if ($this->currentTranslation && $this->currentTranslation->getLocale() === $locale) {
         return $this->currentTranslation;
     }
     $defaultTranslation = $this->translations->get($this->getDefaultLocale());
     if (!($translation = $this->translations->get($locale))) {
         $translation = new BlockTranslation();
         if (!is_null($defaultTranslation)) {
             $translation->setTitle($defaultTranslation->getTitle());
             $translation->setContent($defaultTranslation->getContent());
         }
         $translation->setLocale($locale);
         $this->addTranslation($translation);
     }
     $this->currentTranslation = $translation;
     return $translation;
 }