Page 1 of 1

Plugin dev question

Posted: 07 Apr 2013, 02:07
by lordofthemoon
Hi,
I'm experimenting with my first plugin for TTRSS but am encountering problems. What I'd like to do is to be able to add an icon to the list of headlines in combined view which I can click to open the article in a new tab/window in a single click (rather than right-clicking and selecting "open original article"). Looking at classes/pluginhost.php and the various examples, I thought that HOOK_HEADLINE_TOOLBAR_BUTTON might be my best option, so I wrote a simple plugin with the following 'hook' method, which doesn't work for me:

Code: Select all

       function hook_headline_toolbar_button($feed_id, $is_cat)
        {
                if (get_pref($this->link, "COMBINED_DISPLAY_MODE")) {
                        $rv= "<a href=\"" . $this->link . "\" target=\"_blank\"><img src=\"plugins/openextlink/button.png\" /></a>";
                }

                return $rv;
        } // end method hook_headline_toolbar_button()


My questions are

1) Am I using the right hook to do this?
2) Is there any documentation on what each of hooks do
3) Different hooks seem to take different parameters and return types for the "hook" method (the method with the same name as the hook). Is there any documentation on what these parameters and return types are?
4) I think that my use of $this->link is wrong. What is the $link private member of the Plugin class, and is there any documentation on it?
5) The error message that I get with this code is "Could not update headlines (invalid object received - see error console for details)" [I see no error in Firefox's Error Console, or in the server error.log]. I would guess that I'm wrong in thinking that this method returns a string. Is this correct, and if so, what should I return?

Re: Plugin dev question

Posted: 07 Apr 2013, 03:10
by Latimer
Just a side note, this is exactly what keyboard shortcuts "o" or "v" do.

Re: Plugin dev question

Posted: 07 Apr 2013, 14:30
by lordofthemoon
Latimer wrote:Just a side note, this is exactly what keyboard shortcuts "o" or "v" do.

Thanks for this, but it's something I'd like to do with the mouse for my use case (and I've modified the GoogleReaderKeys plugin to make 'o' close the current article).