diff --git a/modules.local/ppcp-button/src/Assets/SmartButton.php b/modules.local/ppcp-button/src/Assets/SmartButton.php index bb937b3fd..b4625879b 100644 --- a/modules.local/ppcp-button/src/Assets/SmartButton.php +++ b/modules.local/ppcp-button/src/Assets/SmartButton.php @@ -341,12 +341,14 @@ class SmartButton implements SmartButtonInterface 'color' => $this->styleForContext('color', 'mini-cart'), 'shape' => $this->styleForContext('shape', 'mini-cart'), 'label' => $this->styleForContext('label', 'mini-cart'), + 'tagline' => $this->styleForContext('tagline', 'mini-cart'), ], 'style' => [ 'layout' => $this->styleForContext('layout', $this->context()), 'color' => $this->styleForContext('color', $this->context()), 'shape' => $this->styleForContext('shape', $this->context()), 'label' => $this->styleForContext('label', $this->context()), + 'tagline' => $this->styleForContext('tagline', $this->context()), ], ], 'hosted_fields' => [ @@ -372,6 +374,13 @@ class SmartButton implements SmartButtonInterface ], ]; + if ($this->styleForContext('layout', 'mini-cart') !== 'horizontal') { + unset($localize['button']['mini_cart_style']['tagline']); + } + if ($this->styleForContext('layout', $this->context()) !== 'horizontal') { + unset($localize['button']['style']['tagline']); + } + $this->requestData->dequeueNonceFix(); return $localize; } @@ -504,6 +513,7 @@ class SmartButton implements SmartButtonInterface 'color' => 'gold', 'shape' => 'pill', 'label' => 'paypal', + 'tagline' => true, ]; $value = isset($defaults[$style]) ? @@ -512,6 +522,10 @@ class SmartButton implements SmartButtonInterface $this->settings->get('button_' . $style) : $value; $value = $this->settings->has('button_' . $context . '_' . $style) ? $this->settings->get('button_' . $context . '_' . $style) : $value; + + if (is_bool($value)) { + $value = $value ? 'true' : 'false'; + } return $value; } } diff --git a/modules.local/ppcp-wc-gateway/services.php b/modules.local/ppcp-wc-gateway/services.php index e69186e7b..31ca5b99e 100644 --- a/modules.local/ppcp-wc-gateway/services.php +++ b/modules.local/ppcp-wc-gateway/services.php @@ -363,7 +363,7 @@ return [ 'default' => 'vertical', 'desc_tip' => true, 'description' => __( - 'If additional funding sources are available to the buyer through PayPal, such as Venmo, then multiple buttons are displayed in the space provided. Choose "vertical" for a dynamic list of alternative and local payment options, or "horizontal" when space is limited.', + 'If additional funding sources are available to the buyer through PayPal, then multiple buttons are displayed in the space provided. Choose "vertical" for a dynamic list of alternative and local payment options, or "horizontal" when space is limited.', 'woocommerce-paypal-commerce-gateway' ), 'options' => [ @@ -376,6 +376,22 @@ return [ ], 'requirements' => [], ], + 'button_tagline' => [ + 'title' => __('Tagline', 'woocommerce-paypal-commerce-gateway'), + 'type' => 'checkbox', + 'default' => true, + 'label' => __('Enable tagline', 'woocommerce-paypal-commerce-gateway'), + 'desc_tip' => true, + 'description' => __( + 'Add the tagline. This line will only show up, if you select a horizontal layout.', + 'woocommerce-paypal-commerce-gateway' + ), + 'screens' => [ + State::STATE_PROGRESSIVE, + State::STATE_ONBOARDED, + ], + 'requirements' => [], + ], 'button_label' => [ 'title' => __('Button Label', 'woocommerce-paypal-commerce-gateway'), 'type' => 'select', @@ -442,7 +458,7 @@ return [ ], //Single product page - 'button_single_product_heading' => [ + 'button_product_heading' => [ 'heading' => __('Single Product page', 'woocommerce-paypal-commerce-gateway'), 'type' => 'ppcp-heading', 'screens' => [ @@ -451,7 +467,7 @@ return [ ], 'requirements' => [], ], - 'button_single_product_enabled' => [ + 'button_product_enabled' => [ 'title' => __('Enable buttons on Single Product', 'woocommerce-paypal-commerce-gateway'), 'type' => 'checkbox', 'label' => __('Enable on Single Product', 'woocommerce-paypal-commerce-gateway'), @@ -462,7 +478,7 @@ return [ ], 'requirements' => [], ], - 'button_single_product_layout' => [ + 'button_product_layout' => [ 'title' => __('Button Layout', 'woocommerce-paypal-commerce-gateway'), 'type' => 'select', 'class' => ['wc-enhanced-select'], @@ -482,7 +498,23 @@ return [ ], 'requirements' => [], ], - 'button_single_product_label' => [ + 'button_product_tagline' => [ + 'title' => __('Tagline', 'woocommerce-paypal-commerce-gateway'), + 'type' => 'checkbox', + 'label' => __('Enable tagline', 'woocommerce-paypal-commerce-gateway'), + 'default' => true, + 'desc_tip' => true, + 'description' => __( + 'Add the tagline. This line will only show up, if you select a horizontal layout.', + 'woocommerce-paypal-commerce-gateway' + ), + 'screens' => [ + State::STATE_PROGRESSIVE, + State::STATE_ONBOARDED, + ], + 'requirements' => [], + ], + 'button_product_label' => [ 'title' => __('Button Label', 'woocommerce-paypal-commerce-gateway'), 'type' => 'select', 'class' => ['wc-enhanced-select'], @@ -504,7 +536,7 @@ return [ ], 'requirements' => [], ], - 'button_single_product_color' => [ + 'button_product_color' => [ 'title' => __('Color', 'woocommerce-paypal-commerce-gateway'), 'type' => 'select', 'class' => ['wc-enhanced-select'], @@ -526,7 +558,7 @@ return [ ], 'requirements' => [], ], - 'button_single_product_shape' => [ + 'button_product_shape' => [ 'title' => __('Shape', 'woocommerce-paypal-commerce-gateway'), 'type' => 'select', 'class' => ['wc-enhanced-select'], @@ -588,6 +620,22 @@ return [ ], 'requirements' => [], ], + 'button_mini-cart_tagline' => [ + 'title' => __('Tagline', 'woocommerce-paypal-commerce-gateway'), + 'type' => 'checkbox', + 'label' => __('Enable tagline', 'woocommerce-paypal-commerce-gateway'), + 'default' => false, + 'desc_tip' => true, + 'description' => __( + 'Add the tagline. This line will only show up, if you select a horizontal layout.', + 'woocommerce-paypal-commerce-gateway' + ), + 'screens' => [ + State::STATE_PROGRESSIVE, + State::STATE_ONBOARDED, + ], + 'requirements' => [], + ], 'button_mini-cart_label' => [ 'title' => __('Button Label', 'woocommerce-paypal-commerce-gateway'), 'type' => 'select', @@ -694,6 +742,22 @@ return [ ], 'requirements' => [], ], + 'button_cart_tagline' => [ + 'title' => __('Tagline', 'woocommerce-paypal-commerce-gateway'), + 'type' => 'checkbox', + 'label' => __('Enable tagline', 'woocommerce-paypal-commerce-gateway'), + 'default' => true, + 'desc_tip' => true, + 'description' => __( + 'Add the tagline. This line will only show up, if you select a horizontal layout.', + 'woocommerce-paypal-commerce-gateway' + ), + 'screens' => [ + State::STATE_PROGRESSIVE, + State::STATE_ONBOARDED, + ], + 'requirements' => [], + ], 'button_cart_label' => [ 'title' => __('Button Label', 'woocommerce-paypal-commerce-gateway'), 'type' => 'select',