FormRestrictionSettings.php
4.42 KB
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<?php if ( ! defined( 'ABSPATH' ) ) exit;
return apply_filters( 'ninja_forms_from_restriction_settings', array(
/*
* UNIQUE FIELD SET
*/
'unique-field-set' => array(
'name' => 'unique-field-set',
'type' => 'fieldset',
'label' => esc_html__( 'Unique Field', 'ninja-forms' ),
'width' => 'full',
'group' => 'primary',
'settings' => array(
/*
* SET A UNIQUE FIELD
*/
'unique_field' => array(
'name' => 'unique_field',
'type' => 'field-select',
'width' => 'full',
'group' => 'primary',
'field_value_format' => 'key',
/* Optional */
'field_types' => array(
'firstname',
'lastname',
'email',
'textbox',
'listselect',
'listradio',
'listmultiselect',
'date'
),
),
/*
* UNIQUE FIELD ERROR
*/
'unique_field_error' => array(
'name' => 'unique_field_error',
'type' => 'textbox',
'label' => esc_html__( 'Unique Field Error Message', 'ninja-forms' ),
'width' => 'full',
'group' => 'primary',
'value' => esc_textarea( __( 'A form with this value has already been submitted.', 'ninja-forms' ) ),
),
)
),
'logged-in-set' => array(
'name' => 'logged-in-set',
'type' => 'fieldset',
'label' => esc_html__( 'Logged In', 'ninja-forms' ),
'width' => 'full',
'group' => 'primary',
'settings' => array(
/*
* REQUIRE USER TO BE LOGGED IN TO VIEW FORM?
*/
'logged_in' => array(
'name' => 'logged_in',
'type' => 'toggle',
'label' => esc_html__( 'Require user to be logged in to view form?', 'ninja-forms' ),
'width' => 'one-half',
'group' => 'primary',
'value' => FALSE,
'help' => esc_html__( 'Does apply to form preview.', 'ninja-forms' )
),
/*
* NOT LOGGED-IN MESSAGE
*/
'not_logged_in_msg' => array(
'name' => 'not_logged_in_msg',
'type' => 'rte', //TODO: Add WYSIWYG
'label' => esc_html__( 'Not Logged-In Message', 'ninja-forms' ),
'width' => 'full',
'group' => 'primary',
'value' => '',
),
)
),
'limit-submissions-set' => array(
'name' => 'limit-submissions-set',
'type' => 'fieldset',
'label' => esc_html__( 'Limit Submissions', 'ninja-forms' ),
'width' => 'full',
'group' => 'primary',
'settings' => array(
/*
* LIMIT SUBMISSIONS
*/
'sub_limit_number' => array(
'name' => 'sub_limit_number',
'type' => 'number',
'label' => esc_html__( 'Submission Limit', 'ninja-forms' ),
'width' => 'one-third',
'group' => 'primary',
'value' => NULL,
'help' => esc_html__( 'Does NOT apply to form preview.', 'ninja-forms' )
//TODO: Add following text below the element.
//Select the number of submissions that this form will accept. Leave empty for no limit.
),
/*
* LIMIT REACHED MESSAGE
*/
'sub_limit_msg' => array(
'name' => 'sub_limit_msg',
'type' => 'rte',//TODO: Add WYSIWYG
'label' => esc_html__( 'Limit Reached Message', 'ninja-forms' ),
'width' => 'full',
'group' => 'primary',
'value' => esc_textarea( __( 'The form has reached its submission limit.', 'ninja-forms' ) )
//TODO: Add following text below the WYSIWYG.
//Please enter a message that you want displayed when this form has reached its submission limit and will not
//accept new submissions.
),
)
),
));