← All changes
|
app/Services/Renderer/CustomerDashboardButtonRenderer.php
+9
-3
1.3.21
→
1.6.6
View file →
| @@ -20,16 +20,18 @@ | ||
| 20 | 20 | $buttonText = Arr::get($atts, 'button_text', ''); |
| 21 | 21 | $isShortcode = Helper::toBool(Arr::get($atts, 'is_shortcode', false)); |
| 22 | 22 | $linkTarget = Arr::get($atts, 'link_target', '_self'); |
| 23 | 23 | $showIcon = Helper::toBool(Arr::get($atts, 'show_icon', true), true); |
| 24 | + $customClass = trim(Arr::get($atts, 'class', '')); | |
| 25 | + $extraClass = trim(Arr::get($atts, 'extra_class', '')); | |
| 24 | 26 | |
| 25 | 27 | if (empty($buttonText)) { |
| 26 | 28 | $buttonText = __('My Account', 'fluent-cart'); |
| 27 | 29 | } |
| 28 | 30 | |
| 29 | - $class = $displayType === 'button' | |
| 31 | + $class = $customClass ?: ($displayType === 'button' | |
| 30 | 32 | ? 'wp-block-button__link wp-element-button fct-customer-dashboard-btn' |
| 31 | - : 'fct-customer-dashboard-link'; | |
| 33 | + : 'fct-customer-dashboard-link'); | |
| 32 | 34 | |
| 33 | 35 | $linkAtts = [ |
| 34 | 36 | 'href' => TemplateService::getCustomerProfileUrl(), |
| 35 | 37 | 'class' => $class, |
| @@ -40,14 +42,18 @@ | ||
| 40 | 42 | if ($linkTarget === '_blank') { |
| 41 | 43 | $linkAtts['rel'] = 'noopener noreferrer'; |
| 42 | 44 | } |
| 43 | 45 | |
| 46 | + if ($extraClass) { | |
| 47 | + $linkAtts['class'] .= ' ' . $extraClass; | |
| 48 | + } | |
| 49 | + | |
| 44 | 50 | if ($isShortcode) { |
| 45 | 51 | ob_start(); |
| 46 | 52 | $this->renderAttributes($linkAtts); |
| 47 | 53 | $wrapperAttributes = ob_get_clean(); |
| 48 | 54 | } else { |
| 49 | - $wrapperAttributes = get_block_wrapper_attributes($linkAtts); | |
| 55 | + $wrapperAttributes = RenderHelper::getBlockWrapperAttributes($linkAtts); | |
| 50 | 56 | } |
| 51 | 57 | |
| 52 | 58 | ?> |
| 53 | 59 | <a <?php echo |