From 59d25c855354faaf5f065ba9d7be3245b2926372 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luca=20B=C3=B6sch?= Date: Sun, 5 Nov 2023 21:18:35 +0100 Subject: [PATCH] Improvement: Add the option to suppress the footer button, solves #444. --- CHANGES.md | 1 + README.md | 4 ++ lang/en/theme_boost_union.php | 10 +++ layout/columns2.php | 3 + layout/drawers.php | 3 + layout/includes/footer.php | 38 ++++++++++ layout/login.php | 3 + lib.php | 33 +++++++++ settings.php | 15 ++++ templates/theme_boost/footer.mustache | 3 + ...boost_union_contentsettings_footer.feature | 72 +++++++++++++++++++ 11 files changed, 185 insertions(+) create mode 100644 layout/includes/footer.php diff --git a/CHANGES.md b/CHANGES.md index 892b6192772..65e78022588 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,6 +6,7 @@ Changes ### Unreleased +* 2023-12-05 - Improvement: Option to suppress footer button, solves #444. * 2023-12-01 - Bugfix: Static pages unnecessarily cleaned configured content, solves #486. * 2023-11-23 - Bugfix: Add background color to OAuth2 login button, solves #473. diff --git a/README.md b/README.md index e5b85173435..e9eec3f3d47 100644 --- a/README.md +++ b/README.md @@ -379,6 +379,10 @@ In this tab there are the following settings: Whatever you add to this textarea will be displayed at the end of a page, in the footer. Refer to the setting description on the settings page for further instructions. +###### Footer + +With these settings, you can show where to show or whether to suppress the footer (circle containing the question mark) button. + #### Tab "Static pages" In this tab there are the following settings: diff --git a/lang/en/theme_boost_union.php b/lang/en/theme_boost_union.php index 476e64205a8..bd8ec6b14d9 100644 --- a/lang/en/theme_boost_union.php +++ b/lang/en/theme_boost_union.php @@ -439,6 +439,16 @@ // ... ... Setting: Footnote. $string['footnotesetting'] = 'Footnote'; $string['footnotesetting_desc'] = 'Whatever you add to this textarea will be displayed at the end of a page, in the footer (not the floating footer) on every page which uses the layouts "drawers", "columns2" or "login". Content in this area could be for example the copyright, the terms of use or the name of your organisation.
If you want to remove the footnote again, just empty the text area.'; +// ... Section: Footer. +$string['footerheading'] = 'Footer'; +// ... ... Setting: Footer. +$string['enablefooterbutton'] = 'Enable footer'; +$string['enablefooterbutton_desc'] = 'With "footer", the circle containing the question mark at the bottom of the page is meant.
Upon click, the user is presented with an overlay. Depending on the site configuration the links +Help and documentation, Services and support, Contact site support, Login information, Reset user tour on this page, Data retention summary, Get the mobile app, Policies and Powered by Moodle could be shown.
With this setting it is possible to choose on which device to show or entirely suppress this footer button.'; +$string['enablefooterbuttonboth'] = 'Desktop and mobile'; +$string['enablefooterbuttondesktop'] = 'Desktop only'; +$string['enablefooterbuttonmobile'] = 'Mobile only'; +$string['enablefooterbuttonhidden'] = 'Hidden'; // Settings: Static pages tab. $string['staticpagestab'] = 'Static pages'; diff --git a/layout/columns2.php b/layout/columns2.php index 8197e3d427c..5beb96bc77d 100644 --- a/layout/columns2.php +++ b/layout/columns2.php @@ -122,6 +122,9 @@ // Include the template content for the static pages. require_once(__DIR__ . '/includes/staticpages.php'); +// Include the template content for the footer button. +require_once(__DIR__ . '/includes/footer.php'); + // Include the template content for the JavaScript disabled hint. require_once(__DIR__ . '/includes/javascriptdisabledhint.php'); diff --git a/layout/drawers.php b/layout/drawers.php index bf07f6d19ae..a820cf6b849 100644 --- a/layout/drawers.php +++ b/layout/drawers.php @@ -182,6 +182,9 @@ // Include the template content for the static pages. require_once(__DIR__ . '/includes/staticpages.php'); +// Include the template content for the footer button. +require_once(__DIR__ . '/includes/footer.php'); + // Include the template content for the JavaScript disabled hint. require_once(__DIR__ . '/includes/javascriptdisabledhint.php'); diff --git a/layout/includes/footer.php b/layout/includes/footer.php new file mode 100644 index 00000000000..7e1d854d2c8 --- /dev/null +++ b/layout/includes/footer.php @@ -0,0 +1,38 @@ +. + +/** + * Theme Boost Union - Footer question mark button layout include. + * + * @package theme_boost_union + * @copyright 2023 Luca Bösch + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); + +// Require the necessary libraries. +require_once($CFG->dirroot.'/theme/boost_union/locallib.php'); + +$config = get_config('theme_boost_union'); + +// If the footerbutton is enabled. +$footerquestionmark = isset($config->enablefooterbutton) ? $config->enablefooterbutton : + THEME_BOOST_UNION_SETTING_ENABLEFOOTER_BOTH; + +if ($footerquestionmark != THEME_BOOST_UNION_SETTING_ENABLEFOOTER_HIDDEN) { + $templatecontext['footerbutton'] = true; +} diff --git a/layout/login.php b/layout/login.php index d4a61682594..7dd1b3ddb4a 100644 --- a/layout/login.php +++ b/layout/login.php @@ -53,6 +53,9 @@ // Include the template content for the static pages. require_once(__DIR__ . '/includes/staticpages.php'); +// Include the template content for the footer button. +require_once(__DIR__ . '/includes/footer.php'); + // Include the template content for the info banners. require_once(__DIR__ . '/includes/infobanners.php'); diff --git a/lib.php b/lib.php index 01f243e96d4..9c9c3bb2dd5 100644 --- a/lib.php +++ b/lib.php @@ -92,6 +92,11 @@ define('THEME_BOOST_UNION_SETTING_OUTSIDEREGIONSWITH_COURSECONTENTWIDTH', 'coursecontentwidth'); define('THEME_BOOST_UNION_SETTING_OUTSIDEREGIONSWITH_HEROWIDTH', 'herowidth'); +define('THEME_BOOST_UNION_SETTING_ENABLEFOOTER_BOTH', 'enablefooterbuttonall'); +define('THEME_BOOST_UNION_SETTING_ENABLEFOOTER_DESKTOP', 'enablefooterbuttondesktop'); +define('THEME_BOOST_UNION_SETTING_ENABLEFOOTER_MOBILE', 'enablefooterbuttonmobile'); +define('THEME_BOOST_UNION_SETTING_ENABLEFOOTER_HIDDEN', 'enablefooterbuttonhidden'); + /** * Returns the main SCSS content. * @@ -289,6 +294,34 @@ function theme_boost_union_get_extra_scss($theme) { // Setting: Mark external links. $content .= theme_boost_union_get_scss_to_mark_external_links($theme); + // If the footerbutton is enabled. + $footerquestionmark = get_config('theme_boost_union', 'enablefooterbutton'); + + switch ($footerquestionmark) { + case THEME_BOOST_UNION_SETTING_ENABLEFOOTER_BOTH: + $content .= '@media (max-width: 575px) { #page-footer [data-region="footer-container-popover"] .btn-footer-popover ' . + '{ display: block !important; } }' . PHP_EOL; + break; + case THEME_BOOST_UNION_SETTING_ENABLEFOOTER_DESKTOP: + $content .= '@media (min-width: 576px) { #page-footer [data-region="footer-container-popover"] .btn-footer-popover ' . + '{ display: block !important; } }' . PHP_EOL; + $content .= '#page-footer .footer-content-popover.container { display: none !important; }' . PHP_EOL; + break; + case THEME_BOOST_UNION_SETTING_ENABLEFOOTER_MOBILE: + $content .= '@media (min-width: 576px) { #page-footer [data-region="footer-container-popover"] .btn-footer-popover ' . + '{ display: none !important; } }' . PHP_EOL; + $content .= '@media (max-width: 575px) { #page-footer [data-region="footer-container-popover"] .btn-footer-popover ' . + '{ display: block !important; bottom: 5rem; } }' . PHP_EOL; + $content .= '#page-footer .footer-content-popover.container { display: none !important; }' . PHP_EOL; + break; + default: + $content .= '@media (max-width: 575px) { #page-footer [data-region="footer-container-popover"] .btn-footer-popover ' . + '{ display: none !important; } }' . PHP_EOL; + $content .= '@media (max-width: 575px) { #page-footer .footer-content-popover.container ' . + '{ display: none !important; } }' . PHP_EOL; + break; + } + return $content; } diff --git a/settings.php b/settings.php index bfc0642fb95..7866c8d5988 100644 --- a/settings.php +++ b/settings.php @@ -1381,6 +1381,21 @@ $setting = new admin_setting_confightmleditor($name, $title, $description, ''); $tab->add($setting); + // Setting: Footer. + $enablefooterbuttonoptions = [ + 'enablefooterbuttonboth' => get_string('enablefooterbuttonboth', 'theme_boost_union', null, true), + 'enablefooterbuttondesktop' => get_string('enablefooterbuttondesktop', 'theme_boost_union', null, true), + 'enablefooterbuttonmobile' => get_string('enablefooterbuttonmobile', 'theme_boost_union', null, true), + 'enablefooterbuttonhidden' => get_string('enablefooterbuttonhidden', 'theme_boost_union', null, true), + ]; + $name = 'theme_boost_union/enablefooterbutton'; + $title = get_string('enablefooterbutton', 'theme_boost_union', null, true); + $description = get_string('enablefooterbutton_desc', 'theme_boost_union', null, true); + $setting = new admin_setting_configselect($name, $title, $description, 'enablefooterbuttonboth', + $enablefooterbuttonoptions); + $setting->set_updatedcallback('theme_reset_all_caches'); + $tab->add($setting); + // Add tab to settings page. $page->add($tab); diff --git a/templates/theme_boost/footer.mustache b/templates/theme_boost/footer.mustache index 739e0de2e31..043c078a529 100644 --- a/templates/theme_boost/footer.mustache +++ b/templates/theme_boost/footer.mustache @@ -75,6 +75,7 @@ * Added the possibility to show the generic page 2 link. * Added the possibility to show the generic page 3 link. * Added the bottom menu bar to show menus in footer for mobile devices. + * Added the possibility to suppress the footer button (question mark in the circle). }}