MDL-64901 block_myoverview: admin settings to control available layouts

Added an admin setting which allows the administrator to set the available layouts for users and which
defaults to all layouts being available, or the card layout only if no layouts are enabled.
If only one layout is enabled, the dropdown `nav-display-selector` template will not be displayed as
it can no longer be utilised.
If the user preference is set to a layout that is no longer available, this is ignored and the first
available layout defaulted to.
This commit is contained in:
Tom Dickman 2019-03-12 14:26:51 +11:00
parent 29c395187f
commit 5f59a4c063
10 changed files with 109 additions and 34 deletions

View file

@ -34,4 +34,15 @@ if ($ADMIN->fulltree) {
get_string('displaycategories_help', 'block_myoverview'),
1));
$choices = array(BLOCK_MYOVERVIEW_VIEW_CARD => get_string('card', 'block_myoverview'),
BLOCK_MYOVERVIEW_VIEW_LIST => get_string('list', 'block_myoverview'),
BLOCK_MYOVERVIEW_VIEW_SUMMARY => get_string('summary', 'block_myoverview'));
$settings->add(new admin_setting_configmulticheckbox(
'block_myoverview/layouts',
get_string('layouts', 'block_myoverview'),
get_string('layouts_help', 'block_myoverview'),
$choices,
$choices));
}