Last active
April 20, 2017 20:32
-
-
Save Takika/30909a17744ce75a0e31aed8bafe7d77 to your computer and use it in GitHub Desktop.
Roundcube default listing mode plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class listing_mode extends rcube_plugin | |
{ | |
public $task = 'settings'; | |
function init() | |
{ | |
$this->add_hook('preferences_list', array($this, 'preferences_list_hook')); | |
$this->add_hook('preferences_save', array($this, 'preferences_save_hook')); | |
} | |
public function preferences_list_hook($args) | |
{ | |
if ($args['section'] == 'mailbox') { | |
$config = rcmail::get_instance()->config; | |
$listview_select_order = new html_select(array('name' => '_default_list_mode', 'id' => '_default_list_mode')); | |
$listview_select_order->add(rcube_label('list'), 'list'); | |
$listview_select_order->add(rcube_label('threads'), 'threads'); | |
$listview_options = array( | |
'title' => $this->gettext('default_list_mode_label'), | |
'content' => $listview_select_order->show($config->get('default_list_mode', 'list')), | |
); | |
$args['blocks']['main']['options']['listview'] = $listview_options; | |
} | |
return $args; | |
} | |
public function preferences_save_hook($args) | |
{ | |
if ($args['section'] == 'mailbox') { | |
$args['prefs']['default_list_mode'] = isset($_POST['_default_list_mode']) ? $_POST['_default_list_mode'] : 'list'; | |
} | |
return $args; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Seems convenient, thanks for sharing! But.. can you explain where I need to place this file, and how to use it?