From 7cd4d6d8be810a1f72e1cdaf0e552b0753b3fb29 Mon Sep 17 00:00:00 2001 From: lat9 Date: Tue, 14 May 2024 18:57:36 -0400 Subject: [PATCH] Notifier to insert "More Information" and "Important Links" sidebox links (#6451) * Notifier to insert "More Information" sidebox links Similar to PR #6443, but for the "More Information" sidebox. Includes minor reformatting/refactoring. * Might as well include the ezpages sidebox, too --- includes/modules/sideboxes/ezpages.php | 2 ++ .../modules/sideboxes/more_information.php | 27 +++++++++++-------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/includes/modules/sideboxes/ezpages.php b/includes/modules/sideboxes/ezpages.php index 2e7a609d16..1f65513cb3 100644 --- a/includes/modules/sideboxes/ezpages.php +++ b/includes/modules/sideboxes/ezpages.php @@ -67,6 +67,8 @@ $var_linksList = $page_query_list_sidebox; + $zco_notifier->notify('NOTIFY_EZPAGES_SIDEBOX_ADDITIONS', [], $var_linksList); + require($template->get_template_dir('tpl_ezpages.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_ezpages.php'); $zco_notifier->notify('NOTIFY_END_EZPAGES_SIDEBOX'); diff --git a/includes/modules/sideboxes/more_information.php b/includes/modules/sideboxes/more_information.php index dab8e8349c..819c346513 100644 --- a/includes/modules/sideboxes/more_information.php +++ b/includes/modules/sideboxes/more_information.php @@ -9,29 +9,34 @@ */ // initialize -$more_information = array(); +$more_information = []; // test if links should display - if (DEFINE_PAGE_2_STATUS <= 1) { +if (DEFINE_PAGE_2_STATUS <= 1) { $more_information[] = '' . BOX_INFORMATION_PAGE_2 . ''; - } - if (DEFINE_PAGE_3_STATUS <= 1) { +} +if (DEFINE_PAGE_3_STATUS <= 1) { $more_information[] = '' . BOX_INFORMATION_PAGE_3 . ''; - } - if (DEFINE_PAGE_4_STATUS <= 1) { +} +if (DEFINE_PAGE_4_STATUS <= 1) { $more_information[] = '' . BOX_INFORMATION_PAGE_4 . ''; - } +} // insert additional links below to add to the more_information box // Example: // $more_information[] = '' . 'TESTING' . ''; +// ----- +// ... or create an observer-class file that monitors the following notification. +// +$zco_notifier->notify('NOTIFY_MORE_INFORMATION_SIDEBOX_ADDITIONS', [], $more_information); + // only show if links are active - if (sizeof($more_information) > 0) { - require($template->get_template_dir('tpl_more_information.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_more_information.php'); +if (count($more_information) > 0) { + require $template->get_template_dir('tpl_more_information.php', DIR_WS_TEMPLATE, $current_page_base, 'sideboxes') . '/tpl_more_information.php'; $title = BOX_HEADING_MORE_INFORMATION; $title_link = false; - require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default); - } + require $template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base, 'common') . '/' . $column_box_default; +}