HOOK_RENDER_ARTICLE not working...

Development-related discussion, including bundled plugins
mightycoco
Bear Rating Trainee
Bear Rating Trainee
Posts: 38
Joined: 23 Mar 2013, 20:46

HOOK_RENDER_ARTICLE not working...

Postby mightycoco » 23 Mar 2013, 20:52

Hi,

I'm on the current version 1.7.5 and try to write a plugin, which plugs into the feed entry rendering.

Code: Select all

   function init($host) {
      $this->link = $host->get_link();
      $this->host = $host;

      $host->add_hook($host::HOOK_ARTICLE_BUTTON, $this);
      $host->add_hook($host::HOOK_RENDER_ARTICLE, $this);
   }


Code: Select all

   function hook_render_article($article) {
      $article["title"] = "TEST".$article["title"];
      return $article;
   }


Code: Select all

   function hook_article_button($line) {
      return "<img src=\"plugins/MY_PLUGIN/ICON.PNG\"
         style=\"cursor : pointer\" style=\"cursor : pointer\"
         onclick=\"CALLSOMESCRIPT(".$line["id"].")\"
         class='tagsPic' title='".__('TESTING THE BUTTON')."'>";
   }


The additional button shows up correct and works fine, however, the hook_render_article is never called! I also checked the example_article plugin, which doesn't work as well. Any hints?

Thanks for the input,
MC

User avatar
sboulema
Bear Rating Trainee
Bear Rating Trainee
Posts: 15
Joined: 22 Mar 2013, 12:30

Re: HOOK_RENDER_ARTICLE not working...

Postby sboulema » 24 Mar 2013, 16:02

Try:

$host->add_hook($host::HOOK_ARTICLE_FILTER, $this);

function hook_article_filter($article) {

Seems to work for articles that get rendered for the first time, to apply it to old articles you probably have to remove some db cache but have not figured that out yet


Return to “Development”

Who is online

Users browsing this forum: No registered users and 3 guests