Ojs\JournalBundle\Entity\JournalPage::setBody PHP Method

setBody() public method

Set body
public setBody ( string $body ) : JournalPage
$body string
return JournalPage
    public function setBody($body)
    {
        $this->translate()->setBody($body);
        return $this;
    }

Usage Example

コード例 #1
0
 public function importPage($id, $newJournalId)
 {
     $settingsSql = "SELECT setting_name, setting_value, locale FROM static_page_settings WHERE static_page_id = :id";
     $settingsStatement = $this->dbalConnection->prepare($settingsSql);
     $settingsStatement->bindValue('id', $id);
     $settingsStatement->execute();
     $pkpSettings = $settingsStatement->fetchAll();
     $settings = [];
     foreach ($pkpSettings as $setting) {
         $locale = !empty($setting['locale']) ? $setting['locale'] : 'en_US';
         $name = $setting['setting_name'];
         $value = $setting['setting_value'];
         $settings[$locale][$name] = $value;
     }
     $journal = $this->em->getReference('OjsJournalBundle:Journal', $newJournalId);
     if (!$journal) {
         return null;
     }
     $page = new JournalPage();
     $page->setJournal($journal);
     foreach ($settings as $locale => $fields) {
         $title = !empty($fields['title']) ? $fields['title'] : 'Page';
         $content = !empty($fields['content']) ? $fields['content'] : 'This page is intentionally left blank.';
         $page->setCurrentLocale(mb_substr($locale, 0, 2, 'UTF-8'));
         $page->setTitle($title);
         $page->setBody($content);
         $page->setVisible(true);
     }
     return $page;
 }
All Usage Examples Of Ojs\JournalBundle\Entity\JournalPage::setBody