-
Notifications
You must be signed in to change notification settings - Fork 0
/
field-settings.php
99 lines (92 loc) · 2.95 KB
/
field-settings.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
// Do intval on counter here so we don't have to run it each time we use it below. Saves some function calls.
$counter = absint( $counter );
?>
<!-- Label input -->
<tr class="simpay-panel-field">
<th>
<label for="<?php echo "simpay-wc-product-label-{$counter}"; ?>">
<?php esc_html_e( 'Form Field Label', 'simple-pay' ); ?>
</label>
</th>
<td>
<?php simpay_print_field( [
'type' => 'standard',
'subtype' => 'text',
'name' => "_simpay_custom_field[wc-product][{$counter}][label]",
'id' => "simpay-wc-product-label-{$counter}",
'value' => isset( $field['label'] ) ? $field['label'] : '',
'class' => [ 'simpay-field-text', 'simpay-label-input' ],
'attributes' => [ 'data-field-key' => $counter ],
'description' => simpay_form_field_label_description(),
] ); ?>
</td>
</tr>
<!-- Products select (multiple) -->
<tr class="simpay-panel-field">
<th>
<label for="<?php echo "simpay-wc-product-products-{$counter}"; ?>">
<?php esc_html_e( 'Products', 'swcp' ); ?>
</label>
</th>
<td>
<?php simpay_print_field( [
'type' => 'select',
'name' => "_simpay_custom_field[wc-product][{$counter}][products][]",
'id' => "simpay-wc-product-products-{$counter}",
'value' => isset( $field['products'] ) ? $field['products'] : '',
'class' => [ 'simpay-field-dropdown', 'simpay-field-text' ],
'attributes' => [
'data-field-key' => $counter,
'multiple' => true,
],
'options' => \SWCP\get_wc_products(),
'description' => esc_html__( 'Select the products that are available for sale in this form.', 'swcp' ),
] ); ?>
</td>
</tr>
<!-- Stripe metadata input -->
<tr class="simpay-panel-field">
<th>
<label for="<?php echo "simpay-wc-product-metadata-{$counter}"; ?>">
<?php esc_html_e( 'Stripe Metadata Label', 'swcp' ); ?>
</label>
</th>
<td>
<?php simpay_print_field( [
'type' => 'standard',
'subtype' => 'text',
'name' => "_simpay_custom_field[wc-product][{$counter}][metadata]",
'id' => "simpay-wc-product-metadata-{$counter}",
'value' => isset( $field['metadata'] ) ? $field['metadata'] : '',
'class' => [ 'simpay-field-text', 'simpay-label-input' ],
'attributes' => [
'data-field-key' => $counter,
'maxlength' => simpay_metadata_title_length(),
],
'description' => simpay_metadata_label_description(),
] ); ?>
</td>
</tr>
<!-- Hidden ID Field -->
<tr class="simpay-panel-field">
<th>
<?php esc_html_e( 'Field ID:', 'swcp' ); ?>
</th>
<td>
<?php echo absint( $uid );
simpay_print_field( [
'type' => 'standard',
'subtype' => 'hidden',
'name' => "_simpay_custom_field[wc-product][{$counter}][id]",
'id' => "simpay-wc-product-id-{$counter}",
'value' => isset( $field['id'] ) ? $field['id'] : '',
'attributes' => [
'data-field-key' => $counter,
],
] ); ?>
</td>
</tr>