Accessing article version file in plugin

Application Version
OJS 3.2+

Description of issue
I am currently updating the embedGalley-Plugin. I already made a Pull Request, but subsequently realized that my update does not handle different versions of a single article. The consequence currently is that only the most recent article version is rendered, disregarding which article version is clicked.

I had a look into the code of the lensGalley plugin (which is very similar in its functionality) and found there that its display function calls for a parameter in an array to get the current submission to display.

My question now is: How do I get this submission parameter in my code? I already tried it as in the lensGalley plugin but get only “null”. Does the parameter array depend on the hook? If so, is there another way I can get the publication to display?

Hi @GrazingScientist,

Yes, that’s a different hook. Did you try to get the needed variable from a template with TemplateManager::getTemplateVars()? e.g.:

$publication = $smarty->getTemplateVars('publication');
1 Like

Hi @Vitaliy,

thank you! After your hint and some further digging, I came up with a solution:

$publication = $smarty->getTemplateVars('publication');
$xmlGalley = null;
foreach ($publication->getData('galleys') as $galley) {
  if ($galley && in_array($galley->getFileType(), array('application/xml', 'text/xml'))) {
    if ($publication->getId() === $galley->getData('publicationId')) {
      $xmlGalley = $galley;

I still need to check that really the correct version is displayed, but it seems so.

Thanks a lot!



1 Like