First attempt at fixing the PayLater Messaging block on the frontend. The block renders but with default config and not block specific settings.

This commit is contained in:
Daniel Dudzic 2024-04-02 16:15:22 +02:00
parent 6139f071e5
commit d30b44d18e
No known key found for this signature in database
GPG key ID: 31B40D33E3465483
6 changed files with 34 additions and 15 deletions

View file

@ -48,5 +48,6 @@
},
"textdomain": "woocommerce-paypal-payments",
"editorScript": "ppcp-paylater-block",
"editorStyle": "file:./assets/css/edit.css"
"editorStyle": "file:./assets/css/edit.css",
"render": "file:./src/PayLaterBlockRender.php"
}

View file

@ -18,7 +18,9 @@ const blockId = 'woocommerce-paypal-payments/paylater-messages';
registerBlockType( blockId, {
icon: paypalIcon,
edit: Edit,
save,
save() {
return null;
},
} );
document.addEventListener( 'DOMContentLoaded', () => {

View file

@ -22,5 +22,7 @@ export default function save( { attributes } ) {
...paypalAttributes,
};
return <div { ...useBlockProps.save(props) }></div>;
return <div {...useBlockProps.save(props)}>
<div id="ppcp-messages" data-partner-attribution-id="Woo_PPCP"></div>
</div>;
}

View file

@ -0,0 +1,17 @@
<?php
/**
* The Pay Later block render callback.
*
* @package WooCommerce\PayPalCommerce\PayLaterBlock
*/
declare(strict_types=1);
namespace WooCommerce\PayPalCommerce\PayLaterBlock;
$attributes = get_block_wrapper_attributes()
?>
<div id="ppcp-paylater-message-block" <?php echo $attributes; ?>>
<?php echo do_action('ppcp-paylater-message-block', $attributes); ?>
</div>