'affx-btn-wrapper',
'id' => "affiliatex-blocks-style-{$attributes['block_id']}"
]);
// Prepare Gutenberg-specific attributes
$rel = ['noopener'];
if (!empty($attributes['btnRelNoFollow'])) $rel[] = 'nofollow';
if (!empty($attributes['btnRelSponsored'])) $rel[] = 'sponsored';
$attributes['rel'] = implode(' ', $rel);
$attributes['target'] = !empty($attributes['openInNewTab']) ? ' target="_blank"' : '';
$attributes['download'] = !empty($attributes['btnDownload']);
$attributes['classNames'] = implode(' ', $this->get_button_classes($attributes));
}
// Prepare icon HTML
$attributes['iconLeft'] = !empty($attributes['edButtonIcon']) && $attributes['iconPosition'] === 'axBtnleft'
? ''
: '';
$attributes['iconRight'] = !empty($attributes['edButtonIcon']) && $attributes['iconPosition'] === 'axBtnright'
? ''
: '';
return array_merge(['wrapper_attributes' => $wrapper_attributes], $attributes);
}
/**
* Render button using template
*/
protected function render_button($attributes) {
$template_attributes = $this->prepare_template_attributes($attributes);
extract($template_attributes);
ob_start();
include AFFILIATEX_PLUGIN_DIR . '/templates/blocks/buttons.php';
return ob_get_clean();
}
}