Roundcube Community Forum

Third Party Contributions => API Based Plugins => Topic started by: Paco on July 11, 2016, 06:00:15 AM

Title: Add a setting menu for a plugin
Post by: Paco on July 11, 2016, 06:00:15 AM
Hi everyone,

I'm currently learning how to write a plugin for RC and I'm struggling at adding a menu setting for it, as this page is not really helpful (https://github.com/roundcube/roundcubemail/wiki/Plugin-API).

Some published plugins do exactly what I want (application-passwords and twofactor_gauthenticator). They do so :
  - In the function_init() of the plugin
Code: [Select]
$this->register_action('...', array($this, 'function_name'));  - Then in function_name() :
Code: [Select]
$this->register_handler('...', array($this, 'function_form'));
$rcmail = rcmail::get_instance();
$rcmail->output->set_pagetitle('title');
$rcmail->output->send('plugin');
  - In the function_form(), they create a form using the class html_table and output it.
  - And to display the item in the menu, the use a javascript, included in the function_init()

So my question : is there a way to do the same thing without using javascript and html_table ?

I saw in the documentation, that the hook settings_actions should be used to define a new section in the settings screen. But I couldn't find a example explaining how to do it. Could someone explain it to me ?

Many thanks for your future answers !!