From 6940d556a3f602386d83d95328ad34418970d8eb Mon Sep 17 00:00:00 2001
From: Kathrin Osswald <kathrin.osswald@uni-ulm.de>
Date: Tue, 11 Jun 2019 11:28:33 +0200
Subject: [PATCH] Added hide_if function to suitable admin setting
 incoursesettingsswitchtoroleposition and corrected README.md.

---
 CHANGES.md                     | 4 ++++
 README.md                      | 5 ++---
 lang/en/theme_boost_campus.php | 3 +--
 settings.php                   | 2 ++
 4 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index 8661b4b..5f6f556 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -4,6 +4,10 @@ moodle-theme_boost_campus
 Changes
 -------
 
+### Unreleased
+
+* 2019-06-11 - Added hide_if function to suitable admin setting incoursesettingsswitchtoroleposition and corrected README.md.
+
 ### Release v3.7-r1
 
 * 2019-06-04 - Further formal changes to the course_renderer to be constistent with Moodle core.
diff --git a/README.md b/README.md
index 69dda3c..5bf7c83 100644
--- a/README.md
+++ b/README.md
@@ -147,10 +147,9 @@ With this setting you can change the displaying of the context menus. In Boost,
 
 Please note that this change does not affect users who have switched off javascript in their browsers - they will still get the behaviour from Moodle core with a popup course context menu.
 
-##### Move "Switch role to..." to the course settings
+##### Switch role to..." location(s)
 
-With this setting you can move the "Switch role to..." link as a new tab from the user menu to the in-course course menu. The role switching is a feature which is used in course context and thus it is better to place it in the course settings menu than in the user menu.
-Please note that this setting won't have any effect if you do not activate the "In course settings menu" above.
+With this setting you can choose the place where the information to which role a user has switched is being displayed. If set to 'Just in the user menu' (default value), the role information will be displayed right beneath the user's name in the user menu (like in theme Boost). If set to 'Just in the course settings', this information - together with a link to switch back - will be displayed beneath the course, as this functionality is course related. If set to 'Both in the user menu and in the course settings' it will be shown in both places.
 
 ### 4. Tab "Footer Layout Settings"
 
diff --git a/lang/en/theme_boost_campus.php b/lang/en/theme_boost_campus.php
index 24e2f4d..18abc4c 100644
--- a/lang/en/theme_boost_campus.php
+++ b/lang/en/theme_boost_campus.php
@@ -100,8 +100,7 @@ $string['incoursesettingsswitchtorolepositionsetting'] = '"Switch role to..." lo
 $string['incoursesettingsswitchtorolesettingjustmenu'] = 'Just in the user menu';
 $string['incoursesettingsswitchtorolesettingjustcourse'] = 'Just in the course settings';
 $string['incoursesettingsswitchtorolesettingboth'] = 'In both places: in the user menu and in the course settings';
-$string['incoursesettingsswitchtorolepositionsetting_desc'] = 'With this setting you can choose the place where the information to which role a user has switched is being displayed. If set to \'Just in the user menu\' (default value), the role information will be displayed right beneath the user\'s name in the user menu(like in theme Boost). If set to \'Just in the course settings\', this information - together with a link to switch back - will be displayed beneath the course, as this functionality is course related. If set to \'Both in the user menu and in the course settings\' it will be shown in both places. <br/>
-Please note that this setting won\'t have any effect if you do not activate the "In course settings menu" above.';
+$string['incoursesettingsswitchtorolepositionsetting_desc'] = 'With this setting you can choose the place where the information to which role a user has switched is being displayed. If set to \'Just in the user menu\' (default value), the role information will be displayed right beneath the user\'s name in the user menu (like in theme Boost). If set to \'Just in the course settings\', this information - together with a link to switch back - will be displayed beneath the course, as this functionality is course related. If set to \'Both in the user menu and in the course settings\' it will be shown in both places.';
 
 
 // Footer layout settings.
diff --git a/settings.php b/settings.php
index f3a44d7..e17aab8 100644
--- a/settings.php
+++ b/settings.php
@@ -326,6 +326,8 @@ if ($ADMIN->fulltree) {
         $incoursesettingsswitchtorolesetting);
     $setting->set_updatedcallback('theme_reset_all_caches');
     $page->add($setting);
+    $settings->hide_if('theme_boost_campus/incoursesettingsswitchtoroleposition',
+            'theme_boost_campus/showsettingsincourse', 'notchecked');
 
     // Add tab to settings page.
     $settings->add($page);
-- 
GitLab