<?php
// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals

if ( ! defined( 'ABSPATH' ) ) {
	 exit;
}

$asset_base_url = plugin_dir_url( __FILE__ );
$settings_cards = array(
	array(
		'page'        => 'wpefb_general_settings',
		'title'       => __( 'General Settings', 'vedrixa-forms-registration-builder' ),
		'description' => __( 'Form look, attachment settings, and global defaults.', 'vedrixa-forms-registration-builder' ),
		'icon'        => $asset_base_url . 'images/global/general-icon.png',
		'icon_alt'    => __( 'General settings icon', 'vedrixa-forms-registration-builder' ),
	),
	array(
		'page'        => 'wpefb_security',
		'title'       => __( 'Security', 'vedrixa-forms-registration-builder' ),
		'description' => __( 'reCAPTCHA placement and Google reCAPTCHA keys.', 'vedrixa-forms-registration-builder' ),
		'icon'        => $asset_base_url . 'images/global/user_login-icon.png',
		'icon_alt'    => __( 'Security settings icon', 'vedrixa-forms-registration-builder' ),
	),
	array(
		'page'        => 'wpefb_user_accounts',
		'title'       => __( 'User Accounts', 'vedrixa-forms-registration-builder' ),
		'description' => __( 'Password behavior, Manual approvals etc.', 'vedrixa-forms-registration-builder' ),
		'icon'        => $asset_base_url . 'images/global/user-account.png',
		'icon_alt'    => __( 'User accounts settings icon', 'vedrixa-forms-registration-builder' ),
	),
	array(
		'page'        => 'wpefb_email_configuration',
		'title'       => __( 'Email Configuration', 'vedrixa-forms-registration-builder' ),
		'description' => __( 'Admin notifications, multiple email notifications, From email', 'vedrixa-forms-registration-builder' ),
		'icon'        => $asset_base_url . 'images/global/notifications-icon.png',
		'icon_alt'    => __( 'Email configuration settings icon', 'vedrixa-forms-registration-builder' ),
	),
);

/**
 * Filters the global settings dashboard cards.
 *
 * @param array  $settings_cards Default settings cards.
 * @param string $asset_base_url Partial asset base URL.
 */
$settings_cards = (array) apply_filters( 'wpefb_global_settings_cards', $settings_cards, $asset_base_url );
?>
<div class="advrf-wrapper advrforms-settings wrap wef-forms-modern wef-global-modern">
        <div class="advrf-page-title">
            <h1 class="wpefb-page-heading">
                <?php esc_html_e( 'Global Settings', 'vedrixa-forms-registration-builder' ); ?>            </h1>
            <p class="wef-title-muted"><?php esc_html_e( 'Configure global defaults for all forms.', 'vedrixa-forms-registration-builder' ); ?></p>
        </div>
        <div class="advrf-settings-wrap advrforms-admin-content">
			<?php foreach ( $settings_cards as $settings_card ) : ?>
				<?php
				$settings_page = isset( $settings_card['page'] ) ? sanitize_key( (string) $settings_card['page'] ) : '';
				if ( '' === $settings_page ) {
					continue;
				}
				$card_title  = isset( $settings_card['title'] ) ? (string) $settings_card['title'] : '';
				$description = isset( $settings_card['description'] ) ? (string) $settings_card['description'] : '';
				$icon        = isset( $settings_card['icon'] ) ? (string) $settings_card['icon'] : '';
				$icon_alt    = isset( $settings_card['icon_alt'] ) ? (string) $settings_card['icon_alt'] : $card_title;
				?>
				<a class="advrf-setting" href="<?php echo esc_url( admin_url( 'admin.php?page=' . $settings_page ) ); ?>">
					<div class="advrf-setting-icon">
						<img src="<?php echo esc_url( $icon ); ?>" alt="<?php echo esc_attr( $icon_alt ); ?>" style="border-color: transparent; background-color: transparent; box-shadow: 0 0 0 rgba(50, 50, 93, .11), 0 0 0 rgba(0, 0, 0, .08);">
					</div>
					<div class="advrf-setting-content">
						<span class="advrf-setting-title"><?php echo esc_html( $card_title ); ?></span>
						<div class="advrf-setting-desc"><?php echo esc_html( $description ); ?></div>
					</div>
				</a>
			<?php endforeach; ?>
		</div>
    </div>
