renderButton($atts); } protected function renderButton($atts = []): void { $displayType = Arr::get($atts, 'display_type', 'button'); $buttonText = Arr::get($atts, 'button_text', ''); $isShortcode = Helper::toBool(Arr::get($atts, 'is_shortcode', false)); $linkTarget = Arr::get($atts, 'link_target', '_self'); $showIcon = Helper::toBool(Arr::get($atts, 'show_icon', true), true); if (empty($buttonText)) { $buttonText = __('My Account', 'fluent-cart'); } $class = $displayType === 'button' ? 'wp-block-button__link wp-element-button fct-customer-dashboard-btn' : 'fct-customer-dashboard-link'; $linkAtts = [ 'href' => TemplateService::getCustomerProfileUrl(), 'class' => $class, 'aria-label' => $buttonText, 'target' => $linkTarget, ]; if ($linkTarget === '_blank') { $linkAtts['rel'] = 'noopener noreferrer'; } if ($isShortcode) { ob_start(); $this->renderAttributes($linkAtts); $wrapperAttributes = ob_get_clean(); } else { $wrapperAttributes = get_block_wrapper_attributes($linkAtts); } ?> > getUserIcon(); ?> '; } protected function renderAttributes($atts = []): void { foreach ($atts as $attr => $value) { if ($value !== '') { echo esc_attr($attr) . '="' . esc_attr((string)$value) . '" '; } else { echo esc_attr($attr); } } } }