New option to configure BN-Code

Configurable via a wp-config constant, or a new wp-filter.
This commit is contained in:
Philipp Stracker 2024-07-02 16:10:10 +02:00
parent 34245a852b
commit 6efcaa5630
No known key found for this signature in database
7 changed files with 57 additions and 12 deletions

View file

@ -95,14 +95,21 @@ class PayLaterWCBlocksRenderer {
) {
if ( PayLaterWCBlocksModule::is_placement_enabled( $c->get( 'wcgateway.settings.status' ), $location ) ) {
$html = '<div id="' . esc_attr( $attributes['ppcpId'] ?? '' ) . '" class="ppcp-messages" data-partner-attribution-id="Woo_PPCP"></div>';
/**
* The BN code.
*
* @psalm-suppress UndefinedConstant -- PPCP_PAYPAL_BN_CODE
*/
$bn_code = PPCP_PAYPAL_BN_CODE;
$html = '<div id="' . esc_attr( $attributes['ppcpId'] ?? '' ) . '" class="ppcp-messages" data-partner-attribution-id="' . esc_attr( $bn_code ) . '"></div>';
$processor = new \WP_HTML_Tag_Processor( $html );
if ( $processor->next_tag( 'div' ) ) {
$processor->set_attribute( 'data-block-name', esc_attr( $attributes['blockId'] ?? '' ) );
$processor->set_attribute( 'class', 'ppcp-messages' );
$processor->set_attribute( 'data-partner-attribution-id', 'Woo_PPCP' );
$processor->set_attribute( 'data-partner-attribution-id', $bn_code );
if ( $this->layout === 'flex' ) {
$processor->set_attribute( 'data-pp-style-layout', 'flex' );