diff --git a/include/customer_qr_frontend_menu.inc.php b/include/customer_qr_frontend_menu.inc.php new file mode 100644 index 0000000..cc5aa08 --- /dev/null +++ b/include/customer_qr_frontend_menu.inc.php @@ -0,0 +1,105 @@ +get_id() !== 'menubar' || !method_exists($menu, 'register_block')) + { + return; + } + + if (!class_exists('RegisteredBlock')) + { + return; + } + + $menu->register_block(new RegisteredBlock( + 'mbBratonienCustomerQr', + 'QR-Code hochladen', + BRATONIEN_TOOLS_ID + )); +} + +function bratonien_tools_customer_qr_prepare_frontend_menu($menu_ref_array) +{ + if (defined('IN_ADMIN')) + { + return; + } + + $settings = bratonien_tools_customer_qr_settings(); + if (empty($settings['enabled'])) + { + return; + } + + if (!is_array($menu_ref_array) || empty($menu_ref_array[0]) || !is_object($menu_ref_array[0])) + { + return; + } + + $menu = $menu_ref_array[0]; + if (!method_exists($menu, 'get_id') || $menu->get_id() !== 'menubar') + { + return; + } + + $block = $menu->get_block('mbBratonienCustomerQr'); + if ($block === null) + { + return; + } + + $url = htmlspecialchars( + get_root_url().'plugins/'.BRATONIEN_TOOLS_ID.'/customer-qr-upload.php', + ENT_QUOTES, + 'UTF-8' + ); + + // Bootstrap Darkroom renders raw-content blocks directly in the root navbar. + // Keeping this as a separate Piwigo menu block avoids hiding the customer + // action inside mbMenu/"Entdecken" and still follows the normal menubar + // lifecycle instead of modifying the theme. + $block->raw_content = '