From 874a4e92ff8c1ab0f72347445b0b340c3757ebf2 Mon Sep 17 00:00:00 2001 From: Alex P Date: Tue, 17 Oct 2023 09:21:33 +0300 Subject: [PATCH] Add hooks to allow rendering messages near buttons like before --- modules/ppcp-button/resources/css/gateway.scss | 4 ++++ modules/ppcp-button/src/Assets/SmartButton.php | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/modules/ppcp-button/resources/css/gateway.scss b/modules/ppcp-button/resources/css/gateway.scss index b563fcab9..f78d1b5b9 100644 --- a/modules/ppcp-button/resources/css/gateway.scss +++ b/modules/ppcp-button/resources/css/gateway.scss @@ -7,3 +7,7 @@ -webkit-filter: grayscale(100%); filter: grayscale(100%); } + +.ppc-button-wrapper #ppcp-messages:first-child { + padding-top: 10px; +} diff --git a/modules/ppcp-button/src/Assets/SmartButton.php b/modules/ppcp-button/src/Assets/SmartButton.php index bdfeb46ab..aaf97e13b 100644 --- a/modules/ppcp-button/src/Assets/SmartButton.php +++ b/modules/ppcp-button/src/Assets/SmartButton.php @@ -652,8 +652,24 @@ class SmartButton implements SmartButtonInterface { // The wrapper is needed for the loading spinner, // otherwise jQuery block() prevents buttons rendering. echo '
'; + + $hook_gateway_id = str_replace( '-', '_', $gateway_id ); + /** + * A hook executed after rendering of the opening tag for the PCP wrapper (before the inner wrapper for the buttons). + * + * For the PayPal gateway the hook name is ppcp_start_button_wrapper_ppcp_gateway. + */ + do_action( 'ppcp_start_button_wrapper_' . $hook_gateway_id ); + echo '
'; + /** + * A hook executed before rendering of the closing tag for the PCP wrapper (before the inner wrapper for the buttons). + * + * For the PayPal gateway the hook name is ppcp_end_button_wrapper_ppcp_gateway. + */ + do_action( 'ppcp_end_button_wrapper_' . $hook_gateway_id ); + if ( null !== $action_name ) { do_action( $action_name ); }