Add block styling settings

This commit is contained in:
Alex P 2023-11-22 17:25:24 +02:00
parent b014403031
commit 2492957dba
No known key found for this signature in database
GPG key ID: 54487A734A204D71
3 changed files with 244 additions and 4 deletions

View file

@ -1003,6 +1003,9 @@ document.querySelector("#payment").before(document.querySelector("#ppcp-messages
'shape' => $this->style_for_context( 'shape', $this->context() ),
'label' => $this->style_for_context( 'label', $this->context() ),
'tagline' => $this->style_for_context( 'tagline', $this->context() ),
'height' => in_array( $this->context(), array( 'cart-block', 'checkout-block' ), true )
? $this->normalize_height( $this->style_for_context( 'height', $this->context(), 48 ), 40, 55 )
: null,
)
),
),
@ -1351,8 +1354,9 @@ document.querySelector("#payment").before(document.querySelector("#ppcp-messages
* @return string|int
*/
private function style_for_context( string $style, string $context, $default = null ) {
// Use the cart/checkout styles for blocks.
$context = str_replace( '-block', '', $context );
if ( $context === 'checkout-block' ) {
$context = 'checkout-block-express';
}
$defaults = array(
'layout' => 'vertical',