Fix minor attribute naming conflict

This commit is contained in:
Daniel Dudzic 2024-04-20 19:54:24 +02:00
parent 2317c90db4
commit f82074a56e
No known key found for this signature in database
GPG key ID: 31B40D33E3465483
5 changed files with 6 additions and 6 deletions

View file

@ -8,7 +8,7 @@
"example": {},
"parent": [ "woocommerce/cart-totals-block" ],
"attributes": {
"id": {
"blockId": {
"type": "string",
"default": "woocommerce-paypal-payments/cart-paylater-messages"
},

View file

@ -8,7 +8,7 @@
"example": {},
"parent": [ "woocommerce/checkout-totals-block" ],
"attributes": {
"id": {
"blockId": {
"type": "string",
"default": "woocommerce-paypal-payments/checkout-paylater-messages"
},

View file

@ -177,7 +177,7 @@ class PayLaterWCBlocksModule implements ModuleInterface {
array(
'render_callback' => function ( array $attributes ) use ( $c ) {
return PayLaterWCBlocksUtils::render_paylater_block(
$attributes['id'] ?? 'woocommerce-paypal-payments/cart-paylater-messages',
$attributes['blockId'] ?? 'woocommerce-paypal-payments/cart-paylater-messages',
$attributes['ppcpId'] ?? 'ppcp-cart-paylater-messages',
'cart',
$c
@ -198,7 +198,7 @@ class PayLaterWCBlocksModule implements ModuleInterface {
array(
'render_callback' => function ( array $attributes ) use ( $c ) {
return PayLaterWCBlocksUtils::render_paylater_block(
$attributes['id'] ?? 'woocommerce-paypal-payments/checkout-paylater-messages',
$attributes['blockId'] ?? 'woocommerce-paypal-payments/checkout-paylater-messages',
$attributes['ppcpId'] ?? 'ppcp-checkout-paylater-messages',
'checkout',
$c

View file

@ -26,7 +26,7 @@ class PayLaterWCBlocksRenderer {
*/
public function render( array $attributes, string $location, ContainerInterface $c ) {
if ( PayLaterWCBlocksModule::is_placement_enabled( $c->get( 'wcgateway.settings.status' ), $location ) ) {
return '<div id="' . esc_attr( $attributes['ppcpId'] ?? '' ) . '" data-block-name="' . esc_attr( $attributes['id'] ?? '' ) . '" class="ppcp-messages" data-partner-attribution-id="Woo_PPCP"></div>';
return '<div id="' . esc_attr( $attributes['ppcpId'] ?? '' ) . '" data-block-name="' . esc_attr( $attributes['blockId'] ?? '' ) . '" class="ppcp-messages" data-partner-attribution-id="Woo_PPCP"></div>';
}
}
}

View file

@ -65,7 +65,7 @@ class PayLaterWCBlocksUtils {
echo $renderer->render(
array(
// phpcs:ignore
'id' => $block_id,
'blockId' => $block_id,
// phpcs:ignore
'ppcpId' => $ppcp_id,
),