OJS3 Plugin register but don't overload the HTML view

I’m working on a plugin to add a link to download an acceptance letter for the author in PDF.

The plugin get the data of the article (Author/s, title, date of acceptance), and with that, create an url that passes the data to a php program to create the PDF file.

However, the HTML template I am using does not appear.
From base, I used the generic plugin RecommendedByAuthor; but I did not make it appear.
Recently, I did a test with a modified copy of the DevelopedBy block plugin as showed here: https://pkp.sfu.ca/wiki/index.php?title=Writing_a_Block_Plugin and the HTML template did not appear either.

The register function

function register($category, $path){
    $success = parent::register($category, $path);
    if(!Config::getVar('general', 'installed') || defined('RUNNING_UPGRADE')) return $success;
    if($success && $this->getEnabled()){
        HookRegistry::register('Templates::Article::Footer::PageFooter', array($this, 'callbackTemplateArticlePageFooter'));
    }
    return $success;
}

The getTemplatePath function

function getTemplatePath($inCore = false){
    return parent::getTemplatePath($inCore) . 'templates/';
}

The article callbackTemplateArticlePageFooter function

function callbackTemplateArticlePageFooter($hookName, $params){
    $smarty =& $params[1];
    $output =& $params[2];
    $displayedArticle = $smarty->get_template_vars('article');

    // Get Values to use in the Letter
    $authors = $displayedArticle->getAuthors();
    $titulo = $displayedArticle->getTitle();
    $status = $displayedArticle->getStatus();
    $fechaSubmit = $displayedArticle->getDateSubmited();
    $fechaMod = $displayedArticle->getDateStatusModified();

    $nombres = [];
    foreach ($authors as $author) {
        $nombres[] = $author->getFullName();
    }

    $resultado = array(
        'titulo'=>$title,
        'autores'=>$nombres,
        'fechaSubmit' => $fechaSubmit,
        'fechaAceptada' => $fechaMod,
        'status'=>$status
    );

    // Visualizar
    $query = base64_decode( json_encode( $resultado ) );
    $url = "crearCarta.php?data=" . $query;
    $smarty->assign('query', $url);
    $output .= $smarty->fetch($this->getTemplatePath() . 'articleFooter.tpl');
}

By last the template: articleFooter.tpl

  <div id="cartaPDF">
    <h3>{translate key="plugins.generic.carta.header"}</h3>
    <ul>
        <li>
            <a href="{$query}" target='_blank' class='pkp_button_primary'> Ver Carta de Aceptación </a>
        </li>
    </ul>
   </div>

Hi @htorres09

Hmmm…
Is your template articleFooter.tpl in the templates folder?
In your article page footer, do you see anything from your template, e.g. <div id="cartaPDF"> ?
Did you enable the plugin?

Best,
Bozana

p.s.
You should return false at the end of the function callbackTemplateArticlePageFooter – so that other plugins can use the hook…

Yes, articleFooter.tpl is in the templates folder; and it is enables; but no, the tag <div id="cartaPDF"></div> doesn’t appear in the the HTML.

Even when I copy the developedByPlugin change its class name, the version, and in general following the https://pkp.sfu.ca/wiki/index.php?title=Writing_a_Block_Plugin tutorial, it still doesn’t add anything to the html.

Hi @htorres09

Regarding the block plugin that you have tried to change: Did you also do this from that Wiki document: “Start up OJS, go to Journal Setup Step 5.6, and ensure that your plugin exists in the list and is in the right vertical position.”
What OJS version are you using?
The block plugins are always displayed in the sidebar, so I am not sure if this is what you want, where you want to provide the download link?

Regarding the code you have provided above: That was a generic plugin – an adapted copy of RecommendedByAuthor plugin, right?
Did you try to print out something i.e. debug it, e.g. to see if the code in the function callbackTemplateArticlePageFooter is executed and if it comes to the last line “$output .= $smarty->fetch($this->getTemplatePath() . ‘articleFooter.tpl’);”

Hmmm… I cannot tell more at the moment…
Best,
Bozana

Yes, the plugin is shown in the Website Settings/Plugins in the site

I’m using OJS 3.1.0-1

If I enable the developedByPlugin, it is showed in the right side, but if I enable the copy (the one modified) it isn’t showed in the right side.

The plugin I provided here, use the same functions of the recommendedByAuthor plugin; but it wasn’t displayed in the HTML.

Even if I comment those lines and harcoded an url it doesn’t change the HTML. As I said above, even if I copy the developedByPlugin, it isn’t display a new elemente <div>Something</div> in the HTML.

Also, I don’t understand why, but had a weird behaivor when enabling the plugin.
This is with the plugin disabled plugin [TEST] Carta de Aceptación
image

And this happen when I enable it.
image

It adds another instance in the plugin list. When I refresh the page, it only appears one instance enabled.