| 1 |
<?php |
| 2 |
/** |
| 3 |
* Subscription settings admin view. |
| 4 |
* |
| 5 |
* @package SpringDevs\Subscription\Admin |
| 6 |
* |
| 7 |
* @var array $settings_fields Grouped and sorted settings fields. |
| 8 |
*/ |
| 9 |
|
| 10 |
// Exit if accessed directly. |
| 11 |
if ( ! defined( 'ABSPATH' ) ) { |
| 12 |
exit; |
| 13 |
} |
| 14 |
|
| 15 |
wp_enqueue_style( 'wp-subscription-admin-settings', SUBSCRPT_ASSETS . '/css/admin-settings.css', [], SUBSCRPT_VERSION ); |
| 16 |
wp_enqueue_script( 'wp-subscription-admin-settings', SUBSCRPT_ASSETS . '/js/admin-settings.js', [ 'jquery' ], SUBSCRPT_VERSION, true ); |
| 17 |
?> |
| 18 |
<div class="wp-subscription-admin-content list-page subscrpt-subs-list"> |
| 19 |
|
| 20 |
<!-- Page header --> |
| 21 |
<div style="margin-bottom:20px;"> |
| 22 |
<h1 style="font-size:1.375rem;font-weight:700;color:var(--wpsubs-text);margin:0 0 6px;line-height:1.2;"><?php esc_html_e( 'Settings', 'subscription' ); ?></h1> |
| 23 |
<p style="font-size:13px;color:var(--wpsubs-text-muted);margin:0 0 12px;line-height:1.5;"><?php esc_html_e( 'Configure subscription plugin behavior and features.', 'subscription' ); ?></p> |
| 24 |
<div style="border-top:1px dashed #d0d3d7;"></div> |
| 25 |
</div> |
| 26 |
|
| 27 |
<form method="post" action="options.php"> |
| 28 |
<?php settings_fields( 'wp_subscription_settings' ); ?> |
| 29 |
<?php do_settings_sections( 'wp_subscription_settings' ); ?> |
| 30 |
|
| 31 |
<?php foreach ( $settings_fields as $group_id => $group ) : ?> |
| 32 |
<?php |
| 33 |
$fields = array_values( $group['fields'] ?? array() ); |
| 34 |
$field_count = count( $fields ); |
| 35 |
?> |
| 36 |
<div class="wpsubs-table-card" style="margin-bottom:16px;padding:20px 24px;"> |
| 37 |
<?php foreach ( $fields as $idx => $field ) : ?> |
| 38 |
<?php |
| 39 |
$field_type = $field['type'] ?? 'input'; |
| 40 |
$field_data = $field['field_data'] ?? array(); |
| 41 |
SpringDevs\Subscription\Admin\SettingsHelper::render_settings_field( $field_type, $field_data ); |
| 42 |
?> |
| 43 |
<?php if ( 'heading' !== $field_type && $idx + 1 < $field_count ) : ?> |
| 44 |
<div style="border-top:1px solid #f1f5f9;margin:16px 0;"></div> |
| 45 |
<?php endif; ?> |
| 46 |
<?php endforeach; ?> |
| 47 |
</div> |
| 48 |
<?php endforeach; ?> |
| 49 |
|
| 50 |
<div style="margin-top:8px;"> |
| 51 |
<button type="submit" class="wpsubs-btn wpsubs-btn--primary"> |
| 52 |
<?php esc_html_e( 'Save changes', 'subscription' ); ?> |
| 53 |
</button> |
| 54 |
</div> |
| 55 |
</form> |
| 56 |
|
| 57 |
</div> |
| 58 |
|