Allow skins to define which layout options they support (#7235)

pull/7435/head
johndoh 4 years ago committed by GitHub
parent 86d34960c8
commit 9dbe666d4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -261,6 +261,9 @@ class rcube_config
ini_set('error_log', $error_log);
}
// set default screen layouts
$this->prop['supported_layouts'] = array('widescreen', 'desktop', 'list');
// remove deprecated properties
unset($this->prop['dst_active']);
}
@ -405,6 +408,11 @@ class rcube_config
$result = explode(',', $result);
}
}
else if ($name == 'layout') {
if (!in_array($result, $this->prop['supported_layouts'])) {
$result = $this->prop['supported_layouts'][0];
}
}
$plugin = $rcube->plugins->exec_hook('config_get', array(
'name' => $name, 'default' => $def, 'result' => $result));

@ -404,7 +404,7 @@ function rcmail_user_prefs($current = null)
'advanced' => array('name' => rcube::Q($RCMAIL->gettext('advancedoptions'))),
);
if (!isset($no_override['layout'])) {
if (!isset($no_override['layout']) && count($config['supported_layouts']) > 1) {
if (!$current) {
continue 2;
}
@ -412,9 +412,16 @@ function rcmail_user_prefs($current = null)
$field_id = 'rcmfd_layout';
$select = new html_select(array('name' => '_layout', 'id' => $field_id));
$select->add($RCMAIL->gettext('layoutwidescreendesc'), 'widescreen');
$select->add($RCMAIL->gettext('layoutdesktopdesc'), 'desktop');
$select->add($RCMAIL->gettext('layoutlistdesc'), 'list');
$layouts = array(
'widescreen' => 'layoutwidescreendesc',
'desktop' => 'layoutdesktopdesc',
'list' => 'layoutlistdesc'
);
$available_layouts = array_intersect_key($layouts, array_flip($config['supported_layouts']));
foreach ($available_layouts as $val => $label) {
$select->add($RCMAIL->gettext($label), $val);
}
$blocks['main']['options']['layout'] = array(
'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('layout'))),

@ -4,7 +4,7 @@
"license": "Creative Commons Attribution-ShareAlike",
"license-url": "http://creativecommons.org/licenses/by-sa/3.0/",
"config": {
"layout": "widescreen",
"supported_layouts": ["widescreen"],
"jquery_ui_colors_theme": "bootstrap",
"embed_css_location": "/styles/embed.css",
"editor_css_location": "/styles/embed.css",

Loading…
Cancel
Save