<?php
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}
function sifency_addons_generate_backup_button( $type, $label, $section_id = '' ) {
	if ( 'elementor_kit' === $type && ! did_action( 'elementor/loaded' ) ) {
		return '<button class="button" disabled>Update Elementor Kit</button><p><small><em>Elementor plugin is not active.</em></small></p>';
	}

	$query_args = array(
		'export-suite-action' => $type,
	);

	if ( ! empty( $section_id ) ) {
		$query_args['current_tab'] = $section_id;
	}

	$url_with_action = add_query_arg( $query_args );

	$secure_url = wp_nonce_url( $url_with_action, "export_{$type}_nonce" );

	return '
        <a href="' . esc_url( $secure_url ) . '" class="button button-primary sifency-admin-btn">
            ' . esc_html( $label ) . '
        </a>
    ';
}
