diff --git a/CHANGES.md b/CHANGES.md index 454a9efcdb6..a29e6aae173 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,6 +6,7 @@ Changes ### Unreleased +* 2023-11-07 - Improvement: Option to suppress footer button, solves #444. * 2023-11-04 - Bugfix: Pass footnote content without text_to_html div generation, solves #442. * 2023-10-09 - Improvement: Add a direct 'view course' icon on the course management pages, solves #129. * 2023-10-05 - Improvement: Allow the admin to set the background-position of the background and login background images, solves #111. diff --git a/README.md b/README.md index 958cfa83767..bb6aa9d6afa 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 9d1e26286aa..415f147be1a 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/includes/staticpages.php b/layout/includes/staticpages.php index 8baa456251d..cd26c10902f 100644 --- a/layout/includes/staticpages.php +++ b/layout/includes/staticpages.php @@ -60,4 +60,5 @@ $templatecontext[$staticpage.'link'] = theme_boost_union_get_staticpage_link($staticpage); $templatecontext[$staticpage.'pagetitle'] = theme_boost_union_get_staticpage_pagetitle($staticpage); } + $templatecontext['footerbutton'] = false; } 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..b1e5c8bb6db 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,25 @@ 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'); + + if ($footerquestionmark == 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; + PHP_EOL; + } else if ($footerquestionmark == 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; + } else if ($footerquestionmark == 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; + } else { + $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; + } + return $content; } diff --git a/settings.php b/settings.php index bfc0642fb95..24929a04da1 100644 --- a/settings.php +++ b/settings.php @@ -1381,6 +1381,20 @@ $setting = new admin_setting_confightmleditor($name, $title, $description, ''); $tab->add($setting); + // Setting: Footer. + $enablefooterbuttonoptions = array( + '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). }}