Skip to content

Commit

Permalink
set attachment translations per language
Browse files Browse the repository at this point in the history
  • Loading branch information
ahilles107 committed Apr 30, 2015
1 parent cc268c3 commit 7f53486
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions newscoop/admin-files/articles/files/do_edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,19 @@

$em = \Zend_Registry::get('container')->getService('em');
$attachment = $em->getRepository('Newscoop\Entity\Attachment')->findOneById($f_attachment_id);
$language = $em->getRepository('Newscoop\Entity\Language')->findOneById($f_language_selected);
$description = $em->getRepository('Newscoop\Entity\Translation')->findOneBy(array(
'phrase_id' => $attachment->getDescription()->getPhraseId()
'phrase_id' => $attachment->getDescription()->getPhraseId(),
'language' => $language
));

if (!$description) {
$description = new \Newscoop\Entity\Translation($attachment->getDescription()->getPhraseId());
$description->setLanguage($language);
$em->persist($description);
}

$description->setTranslationText($f_description);
$language = $em->getRepository('Newscoop\Entity\Language')->findOneById($f_language_selected);
if ($f_language_specific == "yes") {
$attachment->setLanguage($language);
} else {
Expand Down

0 comments on commit 7f53486

Please sign in to comment.