Show submission language on articles page

Hi there,

you can put the language of an article in the “Languages” field in the backend, but as far as I can see it is never displayed. I want to include this information in my child theme. I thought I could just include them like the keywords (because these information ist part of the controlled vocabulary), but it doesn’t work. Is it enough to call them in the article_details.tpl or do I have to get them first in my THEME.inc.php? Could you provide me with an example?

Thank you and kind regards
Daniela

Hi Daniela,

Does this topic answer your question?

Best,
Amanda Stevens
Public Knowledge Project Team

Hi @astevens,

unfortunately no. I am talking about the metadata field “languages” in OJS 3, which can be added in the workflow settings (Submission Metadata). The values are stored in controlled_vocab_entry_settings.
I don’t know how to display these information (and some others like disciplines, subjects and supporting agencies). As far as I see they aren’t set in ArticleHandler.inc.php, am I correct? So I would need to add the code in order to display them in my .tpl file?

Kind regards
Daniela

Hi Daniela,

Thanks for clarifying what you are trying to do. I found this other topic that discusses how to display keywords in the article, which I think you can also apply to displaying the language. Please let me know if this works.

Best,
Amanda Stevens
Public Knowledge Project Team

Hi @astevens,

thank you! I had some trouble figuring out how to add this to my theme.inc.php, but I finally managed it.

For anyone who needs to do this:
First of all add this line to the init-function

HookRegistry::register(‘ArticleHandler::view’,array($this, ‘articleView’));

Then add a function below the init-function (I did it for subjects and languages):

function articleView($hookName, $args) {
$templateMgr = TemplateManager::getManager($request);
$article =$args[2];
$articleId = $article->getId();

$dao = DAORegistry::getDAO(‘SubmissionSubjectDAO’);
$subjects = $dao->getSubjects($articleId, array(AppLocale::getLocale()));
$templateMgr->assign(‘subjects’, $subjects);

$dao = DAORegistry::getDAO(‘SubmissionLanguageDAO’);
$languages = $dao->getLanguages($articleId, array(AppLocale::getLocale()));
$templateMgr->assign(‘languages’, $languages);
}

Then you can call it in your template:

Language:
{foreach from=$languages item=language}
{foreach name=languages from=$language item=languageItem}
{$languageItem|escape}{if !$smarty.foreach.languages.last}; {/if}
{/foreach}
{/foreach}

Subjects:
{foreach from=$subjects item=subject}
{foreach name=subjects from=$subject item=subjectItem}
{$subjectItem|escape}{if !$smarty.foreach.subjects.last}; {/if}
{/foreach}
{/foreach}

Just one last question: Will you include these information in the next (?) release? It’s great you can add those things with a theme, but I would think, it would be better to have these in the article handler.

Thanks again for your help!

Kind regards
Daniela

I think this is planned for the next release. Perhaps @bozana can confirm?

Hi @UBWolf and @astevens, the keywords will be included i.e. displayed on the article view page, but the real keywords not subjects i.e.:

$submissionKeywordDao = DAORegistry::getDAO(‘SubmissionKeywordDAO’);
$templateMgr->assign(‘keywords’, $submissionKeywordDao->getKeywords($article->getId(), array(AppLocale::getLocale())));

(Earlier, the keywords form OJS 2 were migrated to subjects in OJS3, but this is repaired within this issue: subject and subjectClass migration · Issue #2501 · pkp/pkp-lib · GitHub… so now the keywords are keywords…)

Best,
Bozana

Hi @bozana,

so the subjects metadata field in the backend will disappear with the new version? (just asking, so I know that to tell our editors)

Kind regards
Daniela

Ah, no, no – it will remain there – the subject classification from OJS 2.4.x will be migrated there…