Completed
Branch FET/reg-form-builder/main (7824b3)
by
unknown
69:44 queued 51:49
created
core/db_models/EEM_Form_Input.model.php 2 patches
Indentation   +216 added lines, -216 removed lines patch added patch discarded remove patch
@@ -35,233 +35,233 @@
 block discarded – undo
35 35
 class EEM_Form_Input extends EEM_Form_Element
36 36
 {
37 37
 
38
-    /**
39
-     * @var EEM_Form_Input
40
-     */
41
-    protected static $_instance;
38
+	/**
39
+	 * @var EEM_Form_Input
40
+	 */
41
+	protected static $_instance;
42 42
 
43
-    /**
44
-     * @var RequestInterface
45
-     */
46
-    private $request;
43
+	/**
44
+	 * @var RequestInterface
45
+	 */
46
+	private $request;
47 47
 
48
-    /**
49
-     * @var array
50
-     */
51
-    private $input_types;
48
+	/**
49
+	 * @var array
50
+	 */
51
+	private $input_types;
52 52
 
53 53
 
54
-    protected function __construct(Element $element, InputTypes $input_types, $timezone = null)
55
-    {
56
-        $this->input_types = $input_types;
57
-        $this->singular_item = esc_html__('Form Input', 'event_espresso');
58
-        $this->plural_item   = esc_html__('Form Inputs', 'event_espresso');
54
+	protected function __construct(Element $element, InputTypes $input_types, $timezone = null)
55
+	{
56
+		$this->input_types = $input_types;
57
+		$this->singular_item = esc_html__('Form Input', 'event_espresso');
58
+		$this->plural_item   = esc_html__('Form Inputs', 'event_espresso');
59 59
 
60
-        $this->_tables          = [
61
-            'Form_Input' => new EE_Primary_Table('esp_form_input', 'FIN_ID'),
62
-        ];
63
-        $this->_fields          = [
64
-            'Form_Input' => [
65
-                'FIN_ID'        => new EE_Integer_Field(
66
-                    'FIN_ID',
67
-                    esc_html__('Form Input ID (autoincrement db id)', 'event_espresso'),
68
-                    false
69
-                ),
70
-                'FIN_UUID'      => new EE_Primary_Key_String_Field(
71
-                    'FIN_UUID',
72
-                    esc_html__('Form Input UUID (universally unique identifier)', 'event_espresso')
73
-                ),
74
-                'FIN_adminLabel' => new EE_Plain_Text_Field(
75
-                    'FIN_adminLabel',
76
-                    esc_html__(
77
-                        'Input label displayed in the admin to help differentiate input from others.',
78
-                        'event_espresso'
79
-                    ),
80
-                    true,
81
-                    null
82
-                ),
83
-                'FIN_adminOnly' => new EE_Boolean_Field(
84
-                    'FIN_adminOnly',
85
-                    esc_html__(
86
-                        'Whether or not input is only displayed in the admin. If false, input will appear in public forms',
87
-                        'event_espresso'
88
-                    ),
89
-                    false,
90
-                    false
91
-                ),
92
-                'FIN_belongsTo' => new EE_Foreign_Key_String_Field(
93
-                    'FIN_belongsTo',
94
-                    esc_html__('UUID of parent form section this form input belongs to.', 'event_espresso'),
95
-                    true,
96
-                    null,
97
-                    ['Form_Section']
98
-                ),
99
-                'FIN_helpClass' => new EE_Plain_Text_Field(
100
-                    'FIN_helpClass',
101
-                    esc_html__('Custom HTML classes to be applied to this form input\'s help text.', 'event_espresso'),
102
-                    true,
103
-                    null
104
-                ),
105
-                'FIN_helpText' => new EE_Plain_Text_Field(
106
-                    'FIN_helpText',
107
-                    esc_html__(
108
-                        'Additional text displayed alongside a form input to assist users with completing the form.',
109
-                        'event_espresso'
110
-                    ),
111
-                    true,
112
-                    null
113
-                ),
114
-                'FIN_htmlClass' => new EE_Plain_Text_Field(
115
-                    'FIN_htmlClass',
116
-                    esc_html__('HTML classes to be applied to this form input\'s container.', 'event_espresso'),
117
-                    true,
118
-                    null
119
-                ),
120
-                'FIN_max'     => new EE_Integer_Field(
121
-                    'FIN_max',
122
-                    esc_html__(
123
-                        'Maximum numeric value or maximum characters allowed for form input answer.',
124
-                        'event_espresso'
125
-                    ),
126
-                    false,
127
-                    EE_INF
128
-                ),
129
-                'FIN_min'     => new EE_Integer_Field(
130
-                    'FIN_min',
131
-                    esc_html__(
132
-                        'Minimum numeric value or minimum characters allowed for form input answer.',
133
-                        'event_espresso'
134
-                    ),
135
-                    true,
136
-                    null
137
-                ),
138
-                'FIN_order'     => new EE_Integer_Field(
139
-                    'FIN_order',
140
-                    esc_html__('Order in which form input appears in a form.', 'event_espresso'),
141
-                    false,
142
-                    0
143
-                ),
144
-                'FIN_placeholder' => new EE_Plain_Text_Field(
145
-                    'FIN_placeholder',
146
-                    esc_html__(
147
-                        'Example text displayed within an input to assist users with completing the form.',
148
-                        'event_espresso'
149
-                    ),
150
-                    true,
151
-                    null
152
-                ),
153
-                'FIN_publicLabel' => new EE_Plain_Text_Field(
154
-                    'FIN_publicLabel',
155
-                    esc_html__('Input label displayed on public forms, ie: the actual question text.', 'event_espresso'),
156
-                    true,
157
-                    null
158
-                ),
159
-                'FIN_required' => new EE_Boolean_Field(
160
-                    'FIN_required',
161
-                    esc_html__(
162
-                        'Whether or not the input must be supplied with a value in order to complete the form.',
163
-                        'event_espresso'
164
-                    ),
165
-                    false,
166
-                    false
167
-                ),
168
-                'FIN_requiredText' => new EE_Plain_Text_Field(
169
-                    'FIN_requiredText',
170
-                    esc_html__(
171
-                        'Custom validation text displayed alongside a required form input to assist users with completing the form.',
172
-                        'event_espresso'
173
-                    ),
174
-                    true,
175
-                    null
176
-                ),
177
-                'FIN_status'    => new EE_Enum_Text_Field(
178
-                    'FIN_status',
179
-                    esc_html__(
180
-                        'Whether form input is active, archived, trashed, or used as a default on new forms. Values correspond to the EEM_Form_Input::STATUS_* constants.',
181
-                        'event_espresso'
182
-                    ),
183
-                    false,
184
-                    Element::STATUS_ACTIVE,
185
-                    $element->validStatusOptions()
186
-                ),
187
-                'FIN_type'    => new EE_Enum_Text_Field(
188
-                    'FIN_type',
189
-                    esc_html__(
190
-                        'Form input type. Values correspond to the EventEspresso\core\domain\entities\form\Input::TYPE_* constants.',
191
-                        'event_espresso'
192
-                    ),
193
-                    false,
194
-                    Text::TYPE_TEXT,
195
-                    $this->validTypeOptions()
196
-                ),
197
-                'FIN_wpUser'    => new EE_WP_User_Field(
198
-                    'FIN_wpUser',
199
-                    esc_html__('ID of the WP User that created this form input.', 'event_espresso'),
200
-                    false
201
-                ),
202
-            ],
203
-        ];
204
-        $this->_model_relations = [];
205
-        $this->_model_relations['Form_Section'] = new EE_Belongs_To_Any_Relation();
206
-        // this model is generally available for reading
207
-        $restrictions                              = [];
208
-        $restrictions[ EEM_Base::caps_read ]       = new EE_Restriction_Generator_Public();
209
-        $restrictions[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Reg_Form('FIN_applies_to');
210
-        $restrictions[ EEM_Base::caps_edit ]       = new EE_Restriction_Generator_Reg_Form('FIN_applies_to');
211
-        $restrictions[ EEM_Base::caps_delete ]     = new EE_Restriction_Generator_Reg_Form('FIN_applies_to');
212
-        $this->_cap_restriction_generators         = $restrictions;
213
-        parent::__construct($element, $timezone);
214
-        $this->request = $this->getLoader()->getShared('EventEspresso\core\services\request\RequestInterface');
215
-    }
60
+		$this->_tables          = [
61
+			'Form_Input' => new EE_Primary_Table('esp_form_input', 'FIN_ID'),
62
+		];
63
+		$this->_fields          = [
64
+			'Form_Input' => [
65
+				'FIN_ID'        => new EE_Integer_Field(
66
+					'FIN_ID',
67
+					esc_html__('Form Input ID (autoincrement db id)', 'event_espresso'),
68
+					false
69
+				),
70
+				'FIN_UUID'      => new EE_Primary_Key_String_Field(
71
+					'FIN_UUID',
72
+					esc_html__('Form Input UUID (universally unique identifier)', 'event_espresso')
73
+				),
74
+				'FIN_adminLabel' => new EE_Plain_Text_Field(
75
+					'FIN_adminLabel',
76
+					esc_html__(
77
+						'Input label displayed in the admin to help differentiate input from others.',
78
+						'event_espresso'
79
+					),
80
+					true,
81
+					null
82
+				),
83
+				'FIN_adminOnly' => new EE_Boolean_Field(
84
+					'FIN_adminOnly',
85
+					esc_html__(
86
+						'Whether or not input is only displayed in the admin. If false, input will appear in public forms',
87
+						'event_espresso'
88
+					),
89
+					false,
90
+					false
91
+				),
92
+				'FIN_belongsTo' => new EE_Foreign_Key_String_Field(
93
+					'FIN_belongsTo',
94
+					esc_html__('UUID of parent form section this form input belongs to.', 'event_espresso'),
95
+					true,
96
+					null,
97
+					['Form_Section']
98
+				),
99
+				'FIN_helpClass' => new EE_Plain_Text_Field(
100
+					'FIN_helpClass',
101
+					esc_html__('Custom HTML classes to be applied to this form input\'s help text.', 'event_espresso'),
102
+					true,
103
+					null
104
+				),
105
+				'FIN_helpText' => new EE_Plain_Text_Field(
106
+					'FIN_helpText',
107
+					esc_html__(
108
+						'Additional text displayed alongside a form input to assist users with completing the form.',
109
+						'event_espresso'
110
+					),
111
+					true,
112
+					null
113
+				),
114
+				'FIN_htmlClass' => new EE_Plain_Text_Field(
115
+					'FIN_htmlClass',
116
+					esc_html__('HTML classes to be applied to this form input\'s container.', 'event_espresso'),
117
+					true,
118
+					null
119
+				),
120
+				'FIN_max'     => new EE_Integer_Field(
121
+					'FIN_max',
122
+					esc_html__(
123
+						'Maximum numeric value or maximum characters allowed for form input answer.',
124
+						'event_espresso'
125
+					),
126
+					false,
127
+					EE_INF
128
+				),
129
+				'FIN_min'     => new EE_Integer_Field(
130
+					'FIN_min',
131
+					esc_html__(
132
+						'Minimum numeric value or minimum characters allowed for form input answer.',
133
+						'event_espresso'
134
+					),
135
+					true,
136
+					null
137
+				),
138
+				'FIN_order'     => new EE_Integer_Field(
139
+					'FIN_order',
140
+					esc_html__('Order in which form input appears in a form.', 'event_espresso'),
141
+					false,
142
+					0
143
+				),
144
+				'FIN_placeholder' => new EE_Plain_Text_Field(
145
+					'FIN_placeholder',
146
+					esc_html__(
147
+						'Example text displayed within an input to assist users with completing the form.',
148
+						'event_espresso'
149
+					),
150
+					true,
151
+					null
152
+				),
153
+				'FIN_publicLabel' => new EE_Plain_Text_Field(
154
+					'FIN_publicLabel',
155
+					esc_html__('Input label displayed on public forms, ie: the actual question text.', 'event_espresso'),
156
+					true,
157
+					null
158
+				),
159
+				'FIN_required' => new EE_Boolean_Field(
160
+					'FIN_required',
161
+					esc_html__(
162
+						'Whether or not the input must be supplied with a value in order to complete the form.',
163
+						'event_espresso'
164
+					),
165
+					false,
166
+					false
167
+				),
168
+				'FIN_requiredText' => new EE_Plain_Text_Field(
169
+					'FIN_requiredText',
170
+					esc_html__(
171
+						'Custom validation text displayed alongside a required form input to assist users with completing the form.',
172
+						'event_espresso'
173
+					),
174
+					true,
175
+					null
176
+				),
177
+				'FIN_status'    => new EE_Enum_Text_Field(
178
+					'FIN_status',
179
+					esc_html__(
180
+						'Whether form input is active, archived, trashed, or used as a default on new forms. Values correspond to the EEM_Form_Input::STATUS_* constants.',
181
+						'event_espresso'
182
+					),
183
+					false,
184
+					Element::STATUS_ACTIVE,
185
+					$element->validStatusOptions()
186
+				),
187
+				'FIN_type'    => new EE_Enum_Text_Field(
188
+					'FIN_type',
189
+					esc_html__(
190
+						'Form input type. Values correspond to the EventEspresso\core\domain\entities\form\Input::TYPE_* constants.',
191
+						'event_espresso'
192
+					),
193
+					false,
194
+					Text::TYPE_TEXT,
195
+					$this->validTypeOptions()
196
+				),
197
+				'FIN_wpUser'    => new EE_WP_User_Field(
198
+					'FIN_wpUser',
199
+					esc_html__('ID of the WP User that created this form input.', 'event_espresso'),
200
+					false
201
+				),
202
+			],
203
+		];
204
+		$this->_model_relations = [];
205
+		$this->_model_relations['Form_Section'] = new EE_Belongs_To_Any_Relation();
206
+		// this model is generally available for reading
207
+		$restrictions                              = [];
208
+		$restrictions[ EEM_Base::caps_read ]       = new EE_Restriction_Generator_Public();
209
+		$restrictions[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Reg_Form('FIN_applies_to');
210
+		$restrictions[ EEM_Base::caps_edit ]       = new EE_Restriction_Generator_Reg_Form('FIN_applies_to');
211
+		$restrictions[ EEM_Base::caps_delete ]     = new EE_Restriction_Generator_Reg_Form('FIN_applies_to');
212
+		$this->_cap_restriction_generators         = $restrictions;
213
+		parent::__construct($element, $timezone);
214
+		$this->request = $this->getLoader()->getShared('EventEspresso\core\services\request\RequestInterface');
215
+	}
216 216
 
217 217
 
218
-    /**
219
-     * @param bool $constants_only
220
-     * @return array
221
-     */
222
-    public function validTypeOptions(bool $constants_only = false): array
223
-    {
224
-        return $this->input_types->validTypeOptions($constants_only);
225
-    }
218
+	/**
219
+	 * @param bool $constants_only
220
+	 * @return array
221
+	 */
222
+	public function validTypeOptions(bool $constants_only = false): array
223
+	{
224
+		return $this->input_types->validTypeOptions($constants_only);
225
+	}
226 226
 
227 227
 
228
-    /**
229
-     * @return EE_Form_Input[]
230
-     * @throws EE_Error
231
-     */
232
-    public function getFormInputsForSection(string $relation, string $related_UUID): array
233
-    {
234
-        $where_params = [$relation => $related_UUID];
235
-        $query_params = $this->addDefaultWhereConditions([$where_params]);
236
-        $query_params = $this->addOrderByQueryParams($query_params);
237
-        return $this->get_all($query_params);
238
-    }
228
+	/**
229
+	 * @return EE_Form_Input[]
230
+	 * @throws EE_Error
231
+	 */
232
+	public function getFormInputsForSection(string $relation, string $related_UUID): array
233
+	{
234
+		$where_params = [$relation => $related_UUID];
235
+		$query_params = $this->addDefaultWhereConditions([$where_params]);
236
+		$query_params = $this->addOrderByQueryParams($query_params);
237
+		return $this->get_all($query_params);
238
+	}
239 239
 
240 240
 
241
-    /**
242
-     * @param array $query_params
243
-     * @return array
244
-     */
245
-    private function addDefaultWhereConditions(array $query_params): array
246
-    {
247
-        // might need to add a way to identify GQL requests for admin domains
248
-        $admin_request                            = $this->request->isAdmin() || $this->request->isAdminAjax();
249
-        $query_params['default_where_conditions'] = $admin_request
250
-            ? EEM_Base::default_where_conditions_none
251
-            : EEM_Base::default_where_conditions_all;
252
-        return $query_params;
253
-    }
241
+	/**
242
+	 * @param array $query_params
243
+	 * @return array
244
+	 */
245
+	private function addDefaultWhereConditions(array $query_params): array
246
+	{
247
+		// might need to add a way to identify GQL requests for admin domains
248
+		$admin_request                            = $this->request->isAdmin() || $this->request->isAdminAjax();
249
+		$query_params['default_where_conditions'] = $admin_request
250
+			? EEM_Base::default_where_conditions_none
251
+			: EEM_Base::default_where_conditions_all;
252
+		return $query_params;
253
+	}
254 254
 
255 255
 
256
-    /**
257
-     * form inputs should always be sorted in ascending order via the FIN_order field
258
-     *
259
-     * @param array $query_params
260
-     * @return array
261
-     */
262
-    private function addOrderByQueryParams(array $query_params): array
263
-    {
264
-        $query_params['order_by'] = ['FIN_order' => 'ASC'];
265
-        return $query_params;
266
-    }
256
+	/**
257
+	 * form inputs should always be sorted in ascending order via the FIN_order field
258
+	 *
259
+	 * @param array $query_params
260
+	 * @return array
261
+	 */
262
+	private function addOrderByQueryParams(array $query_params): array
263
+	{
264
+		$query_params['order_by'] = ['FIN_order' => 'ASC'];
265
+		return $query_params;
266
+	}
267 267
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -205,10 +205,10 @@
 block discarded – undo
205 205
         $this->_model_relations['Form_Section'] = new EE_Belongs_To_Any_Relation();
206 206
         // this model is generally available for reading
207 207
         $restrictions                              = [];
208
-        $restrictions[ EEM_Base::caps_read ]       = new EE_Restriction_Generator_Public();
209
-        $restrictions[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Reg_Form('FIN_applies_to');
210
-        $restrictions[ EEM_Base::caps_edit ]       = new EE_Restriction_Generator_Reg_Form('FIN_applies_to');
211
-        $restrictions[ EEM_Base::caps_delete ]     = new EE_Restriction_Generator_Reg_Form('FIN_applies_to');
208
+        $restrictions[EEM_Base::caps_read]       = new EE_Restriction_Generator_Public();
209
+        $restrictions[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Reg_Form('FIN_applies_to');
210
+        $restrictions[EEM_Base::caps_edit]       = new EE_Restriction_Generator_Reg_Form('FIN_applies_to');
211
+        $restrictions[EEM_Base::caps_delete]     = new EE_Restriction_Generator_Reg_Form('FIN_applies_to');
212 212
         $this->_cap_restriction_generators         = $restrictions;
213 213
         parent::__construct($element, $timezone);
214 214
         $this->request = $this->getLoader()->getShared('EventEspresso\core\services\request\RequestInterface');
Please login to merge, or discard this patch.
core/db_models/EEM_WP_User.model.php 1 patch
Indentation   +122 added lines, -122 removed lines patch added patch discarded remove patch
@@ -13,132 +13,132 @@
 block discarded – undo
13 13
 class EEM_WP_User extends EEM_Base
14 14
 {
15 15
 
16
-    /**
17
-     * private instance of the EEM_WP_User object
18
-     *
19
-     * @type EEM_WP_User
20
-     */
21
-    protected static $_instance;
16
+	/**
17
+	 * private instance of the EEM_WP_User object
18
+	 *
19
+	 * @type EEM_WP_User
20
+	 */
21
+	protected static $_instance;
22 22
 
23 23
 
24
-    /**
25
-     *    constructor
26
-     *
27
-     * @param null              $timezone
28
-     * @param ModelFieldFactory $model_field_factory
29
-     * @throws EE_Error
30
-     * @throws InvalidArgumentException
31
-     */
32
-    protected function __construct($timezone = null, ModelFieldFactory $model_field_factory)
33
-    {
34
-        $this->singular_item = esc_html__('WP_User', 'event_espresso');
35
-        $this->plural_item = esc_html__('WP_Users', 'event_espresso');
36
-        global $wpdb;
37
-        $this->_tables = array(
38
-            'WP_User' => new EE_Primary_Table($wpdb->users, 'ID', true),
39
-        );
40
-        $this->_fields = array(
41
-            'WP_User' => array(
42
-                'ID'                  => $model_field_factory->createPrimaryKeyIntField(
43
-                    'ID',
44
-                    esc_html__('WP_User ID', 'event_espresso')
45
-                ),
46
-                'user_login'          => $model_field_factory->createPlainTextField(
47
-                    'user_login',
48
-                    esc_html__('User Login', 'event_espresso'),
49
-                    false
50
-                ),
51
-                'user_pass'           => $model_field_factory->createPlainTextField(
52
-                    'user_pass',
53
-                    esc_html__('User Password', 'event_espresso'),
54
-                    false
55
-                ),
56
-                'user_nicename'       => $model_field_factory->createPlainTextField(
57
-                    'user_nicename',
58
-                    esc_html__(' User Nice Name', 'event_espresso'),
59
-                    false
60
-                ),
61
-                'user_email'          => $model_field_factory->createEmailField(
62
-                    'user_email',
63
-                    esc_html__('User Email', 'event_espresso'),
64
-                    false
65
-                ),
66
-                'user_registered'     => $model_field_factory->createDatetimeField(
67
-                    'user_registered',
68
-                    esc_html__('Date User Registered', 'event_espresso'),
69
-                    $timezone
70
-                ),
71
-                'user_activation_key' => $model_field_factory->createPlainTextField(
72
-                    'user_activation_key',
73
-                    esc_html__('User Activation Key', 'event_espresso'),
74
-                    false
75
-                ),
76
-                'user_status'         => $model_field_factory->createIntegerField(
77
-                    'user_status',
78
-                    esc_html__('User Status', 'event_espresso')
79
-                ),
80
-                'display_name'        => $model_field_factory->createPlainTextField(
81
-                    'display_name',
82
-                    esc_html__('Display Name', 'event_espresso'),
83
-                    false
84
-                ),
85
-            ),
86
-        );
87
-        $this->_model_relations = array(
88
-            'Attendee'       => new EE_Has_Many_Relation(),
89
-            // all models are related to the change log
90
-            // 'Change_Log'     => new EE_Has_Many_Relation(),
91
-            'Event'          => new EE_Has_Many_Relation(),
92
-            'Message'        => new EE_Has_Many_Relation(),
93
-            'Payment_Method' => new EE_Has_Many_Relation(),
94
-            'Price'          => new EE_Has_Many_Relation(),
95
-            'Price_Type'     => new EE_Has_Many_Relation(),
96
-            'Question'       => new EE_Has_Many_Relation(),
97
-            'Question_Group' => new EE_Has_Many_Relation(),
98
-            'Ticket'         => new EE_Has_Many_Relation(),
99
-            'Venue'          => new EE_Has_Many_Relation(),
100
-        );
101
-        $this->foreign_key_aliases = [
102
-            'Event.EVT_wp_user'          => 'WP_User.ID',
103
-            'Payment_Method.PMD_wp_user' => 'WP_User.ID',
104
-            'Price.PRC_wp_user'          => 'WP_User.ID',
105
-            'Price_Type.PRT_wp_user'     => 'WP_User.ID',
106
-            'Question.QST_wp_user'       => 'WP_User.ID',
107
-            'Question_Group.QSG_wp_user' => 'WP_User.ID',
108
-            'Ticket.VNU_wp_user'         => 'WP_User.ID',
109
-            'Venue.TKT_wp_user'          => 'WP_User.ID',
110
-        ];
111
-        $this->_wp_core_model = true;
112
-        $this->_caps_slug = 'users';
113
-        $this->_cap_contexts_to_cap_action_map[ EEM_Base::caps_read ] = 'list';
114
-        $this->_cap_contexts_to_cap_action_map[ EEM_Base::caps_read_admin ] = 'list';
115
-        foreach ($this->_cap_contexts_to_cap_action_map as $context => $action) {
116
-            $this->_cap_restriction_generators[ $context ] = new EE_Restriction_Generator_WP_User();
117
-        }
118
-        // @todo: account for create_users controls whether they can create users at all
119
-        parent::__construct($timezone);
120
-    }
24
+	/**
25
+	 *    constructor
26
+	 *
27
+	 * @param null              $timezone
28
+	 * @param ModelFieldFactory $model_field_factory
29
+	 * @throws EE_Error
30
+	 * @throws InvalidArgumentException
31
+	 */
32
+	protected function __construct($timezone = null, ModelFieldFactory $model_field_factory)
33
+	{
34
+		$this->singular_item = esc_html__('WP_User', 'event_espresso');
35
+		$this->plural_item = esc_html__('WP_Users', 'event_espresso');
36
+		global $wpdb;
37
+		$this->_tables = array(
38
+			'WP_User' => new EE_Primary_Table($wpdb->users, 'ID', true),
39
+		);
40
+		$this->_fields = array(
41
+			'WP_User' => array(
42
+				'ID'                  => $model_field_factory->createPrimaryKeyIntField(
43
+					'ID',
44
+					esc_html__('WP_User ID', 'event_espresso')
45
+				),
46
+				'user_login'          => $model_field_factory->createPlainTextField(
47
+					'user_login',
48
+					esc_html__('User Login', 'event_espresso'),
49
+					false
50
+				),
51
+				'user_pass'           => $model_field_factory->createPlainTextField(
52
+					'user_pass',
53
+					esc_html__('User Password', 'event_espresso'),
54
+					false
55
+				),
56
+				'user_nicename'       => $model_field_factory->createPlainTextField(
57
+					'user_nicename',
58
+					esc_html__(' User Nice Name', 'event_espresso'),
59
+					false
60
+				),
61
+				'user_email'          => $model_field_factory->createEmailField(
62
+					'user_email',
63
+					esc_html__('User Email', 'event_espresso'),
64
+					false
65
+				),
66
+				'user_registered'     => $model_field_factory->createDatetimeField(
67
+					'user_registered',
68
+					esc_html__('Date User Registered', 'event_espresso'),
69
+					$timezone
70
+				),
71
+				'user_activation_key' => $model_field_factory->createPlainTextField(
72
+					'user_activation_key',
73
+					esc_html__('User Activation Key', 'event_espresso'),
74
+					false
75
+				),
76
+				'user_status'         => $model_field_factory->createIntegerField(
77
+					'user_status',
78
+					esc_html__('User Status', 'event_espresso')
79
+				),
80
+				'display_name'        => $model_field_factory->createPlainTextField(
81
+					'display_name',
82
+					esc_html__('Display Name', 'event_espresso'),
83
+					false
84
+				),
85
+			),
86
+		);
87
+		$this->_model_relations = array(
88
+			'Attendee'       => new EE_Has_Many_Relation(),
89
+			// all models are related to the change log
90
+			// 'Change_Log'     => new EE_Has_Many_Relation(),
91
+			'Event'          => new EE_Has_Many_Relation(),
92
+			'Message'        => new EE_Has_Many_Relation(),
93
+			'Payment_Method' => new EE_Has_Many_Relation(),
94
+			'Price'          => new EE_Has_Many_Relation(),
95
+			'Price_Type'     => new EE_Has_Many_Relation(),
96
+			'Question'       => new EE_Has_Many_Relation(),
97
+			'Question_Group' => new EE_Has_Many_Relation(),
98
+			'Ticket'         => new EE_Has_Many_Relation(),
99
+			'Venue'          => new EE_Has_Many_Relation(),
100
+		);
101
+		$this->foreign_key_aliases = [
102
+			'Event.EVT_wp_user'          => 'WP_User.ID',
103
+			'Payment_Method.PMD_wp_user' => 'WP_User.ID',
104
+			'Price.PRC_wp_user'          => 'WP_User.ID',
105
+			'Price_Type.PRT_wp_user'     => 'WP_User.ID',
106
+			'Question.QST_wp_user'       => 'WP_User.ID',
107
+			'Question_Group.QSG_wp_user' => 'WP_User.ID',
108
+			'Ticket.VNU_wp_user'         => 'WP_User.ID',
109
+			'Venue.TKT_wp_user'          => 'WP_User.ID',
110
+		];
111
+		$this->_wp_core_model = true;
112
+		$this->_caps_slug = 'users';
113
+		$this->_cap_contexts_to_cap_action_map[ EEM_Base::caps_read ] = 'list';
114
+		$this->_cap_contexts_to_cap_action_map[ EEM_Base::caps_read_admin ] = 'list';
115
+		foreach ($this->_cap_contexts_to_cap_action_map as $context => $action) {
116
+			$this->_cap_restriction_generators[ $context ] = new EE_Restriction_Generator_WP_User();
117
+		}
118
+		// @todo: account for create_users controls whether they can create users at all
119
+		parent::__construct($timezone);
120
+	}
121 121
 
122 122
 
123
-    /**
124
-     * We don't need a foreign key to the WP_User model, we just need its primary key
125
-     *
126
-     * @return string
127
-     * @throws EE_Error
128
-     */
129
-    public function wp_user_field_name()
130
-    {
131
-        return $this->primary_key_name();
132
-    }
123
+	/**
124
+	 * We don't need a foreign key to the WP_User model, we just need its primary key
125
+	 *
126
+	 * @return string
127
+	 * @throws EE_Error
128
+	 */
129
+	public function wp_user_field_name()
130
+	{
131
+		return $this->primary_key_name();
132
+	}
133 133
 
134 134
 
135
-    /**
136
-     * This WP_User model IS owned, even though it doesn't have a foreign key to itself
137
-     *
138
-     * @return boolean
139
-     */
140
-    public function is_owned()
141
-    {
142
-        return true;
143
-    }
135
+	/**
136
+	 * This WP_User model IS owned, even though it doesn't have a foreign key to itself
137
+	 *
138
+	 * @return boolean
139
+	 */
140
+	public function is_owned()
141
+	{
142
+		return true;
143
+	}
144 144
 }
Please login to merge, or discard this patch.
core/db_classes/EE_Form_Input.class.php 1 patch
Indentation   +445 added lines, -445 removed lines patch added patch discarded remove patch
@@ -28,449 +28,449 @@
 block discarded – undo
28 28
 class EE_Form_Input extends EE_Base_Class
29 29
 {
30 30
 
31
-    /**
32
-     * @param array $props_n_values
33
-     * @return EE_Form_Input
34
-     * @throws EE_Error
35
-     * @throws ReflectionException
36
-     */
37
-    public static function new_instance(array $props_n_values = []): EE_Form_Input
38
-    {
39
-        $has_object = parent::_check_for_object($props_n_values, __CLASS__);
40
-        return $has_object
41
-            ?: new self($props_n_values);
42
-    }
43
-
44
-
45
-    /**
46
-     * @param array $props_n_values
47
-     * @return EE_Form_Input
48
-     * @throws EE_Error
49
-     * @throws ReflectionException
50
-     */
51
-    public static function new_instance_from_db(array $props_n_values = []): EE_Form_Input
52
-    {
53
-        return new self($props_n_values);
54
-    }
55
-
56
-
57
-    /**
58
-     * Form Input UUID (universally unique identifier)
59
-     *
60
-     * @return string
61
-     * @throws EE_Error
62
-     * @throws ReflectionException
63
-     */
64
-    public function UUID(): string
65
-    {
66
-        return $this->get('FIN_UUID');
67
-    }
68
-
69
-
70
-    /**
71
-     * @param string $UUID
72
-     * @throws EE_Error
73
-     * @throws ReflectionException
74
-     */
75
-    public function setUUID(string $UUID)
76
-    {
77
-        $this->set('FIN_UUID', $UUID);
78
-    }
79
-
80
-
81
-    /**
82
-     * Input label displayed in the admin to help differentiate input from others
83
-     *
84
-     * @return string
85
-     * @throws EE_Error
86
-     * @throws ReflectionException
87
-     */
88
-    public function adminLabel(): string
89
-    {
90
-        return $this->get('FIN_adminLabel');
91
-    }
92
-
93
-
94
-    /**
95
-     * @param string $admin_label
96
-     * @throws EE_Error
97
-     * @throws ReflectionException
98
-     */
99
-    public function setAdminLabel(string $admin_label)
100
-    {
101
-        $this->set('FIN_adminLabel', $admin_label);
102
-    }
103
-
104
-
105
-    /**
106
-     * Whether or not input is only displayed in the admin. If false, input will appear in public forms
107
-     *
108
-     * @return bool
109
-     * @throws EE_Error
110
-     * @throws ReflectionException
111
-     */
112
-    public function adminOnly(): bool
113
-    {
114
-        return $this->get('FIN_adminOnly');
115
-    }
116
-
117
-
118
-    /**
119
-     * @param bool $admin_only
120
-     * @throws EE_Error
121
-     * @throws ReflectionException
122
-     */
123
-    public function setAdminOnly(bool $admin_only)
124
-    {
125
-        $this->set('FIN_adminOnly', $admin_only);
126
-    }
127
-
128
-
129
-    /**
130
-     * UUID of parent form section this form input belongs to.
131
-     *
132
-     * @return string
133
-     * @throws EE_Error
134
-     * @throws ReflectionException
135
-     */
136
-    public function belongsTo(): string
137
-    {
138
-        return $this->get('FIN_belongsTo');
139
-    }
140
-
141
-
142
-    /**
143
-     * @param string $relation_UUID
144
-     * @throws EE_Error
145
-     * @throws ReflectionException
146
-     */
147
-    public function setBelongsTo(string $relation_UUID)
148
-    {
149
-        $this->set('FIN_belongsTo', $relation_UUID);
150
-    }
151
-
152
-
153
-    /**
154
-     * Custom HTML classes to be applied to this form input's help text.
155
-     *
156
-     * @return string
157
-     * @throws EE_Error
158
-     * @throws ReflectionException
159
-     */
160
-    public function helpClass(): string
161
-    {
162
-        return $this->get('FIN_helpClass');
163
-    }
164
-
165
-
166
-    /**
167
-     * @param string $help_class
168
-     * @throws EE_Error
169
-     * @throws ReflectionException
170
-     */
171
-    public function setHelpClass(string $help_class)
172
-    {
173
-        $this->set('FIN_helpClass', $help_class);
174
-    }
175
-
176
-
177
-    /**
178
-     * Additional text displayed alongside a form input to assist users with completing the form.
179
-     *
180
-     * @return string
181
-     * @throws EE_Error
182
-     * @throws ReflectionException
183
-     */
184
-    public function helpText(): string
185
-    {
186
-        return $this->get('FIN_helpText');
187
-    }
188
-
189
-
190
-    /**
191
-     * @param string $help_text
192
-     * @throws EE_Error
193
-     * @throws ReflectionException
194
-     */
195
-    public function setHelpText(string $help_text)
196
-    {
197
-        $this->set('FIN_helpText', $help_text);
198
-    }
199
-
200
-
201
-    /**
202
-     * HTML classes to be applied to this form input's container.
203
-     *
204
-     * @return string
205
-     * @throws EE_Error
206
-     * @throws ReflectionException
207
-     */
208
-    public function htmlClass(): string
209
-    {
210
-        return $this->get('FIN_htmlClass');
211
-    }
212
-
213
-
214
-    /**
215
-     * HTML classes to be applied to this form input's container.
216
-     *
217
-     * @param string $html_class
218
-     * @throws EE_Error
219
-     * @throws ReflectionException
220
-     */
221
-    public function setHtmlClass(string $html_class)
222
-    {
223
-        $this->set('FIN_htmlClass', $html_class);
224
-    }
225
-
226
-
227
-    /**
228
-     * Maximum numeric value or maximum characters allowed for form input answer.
229
-     *
230
-     * @return int
231
-     * @throws EE_Error
232
-     * @throws ReflectionException
233
-     */
234
-    public function max(): int
235
-    {
236
-        return $this->get('FIN_max');
237
-    }
238
-
239
-
240
-    /**
241
-     * @param int $max
242
-     * @throws EE_Error
243
-     * @throws ReflectionException
244
-     */
245
-    public function setMax(int $max)
246
-    {
247
-        $this->set('FIN_max', $max);
248
-    }
249
-
250
-
251
-
252
-    /**
253
-     * Minimum numeric value or minimum characters allowed for form input answer.
254
-     *
255
-     * @return int
256
-     * @throws EE_Error
257
-     * @throws ReflectionException
258
-     */
259
-    public function min(): int
260
-    {
261
-        return $this->get('FIN_min');
262
-    }
263
-
264
-
265
-    /**
266
-     * @param int $min
267
-     * @throws EE_Error
268
-     * @throws ReflectionException
269
-     */
270
-    public function setMin(int $min)
271
-    {
272
-        $this->set('FIN_min', $min);
273
-    }
274
-
275
-
276
-
277
-    /**
278
-     * Order in which form input appears in a form.
279
-     *
280
-     * @return int
281
-     * @throws EE_Error
282
-     * @throws ReflectionException
283
-     */
284
-    public function order(): int
285
-    {
286
-        return $this->get('FIN_order');
287
-    }
288
-
289
-
290
-    /**
291
-     * Order in which form input appears in a form.
292
-     *
293
-     * @param int $order
294
-     * @throws EE_Error
295
-     * @throws ReflectionException
296
-     */
297
-    public function setOrder(int $order)
298
-    {
299
-        $this->set('FIN_order', $order);
300
-    }
301
-
302
-
303
-    /**
304
-     * Example text displayed within an input to assist users with completing the form.
305
-     *
306
-     * @return string
307
-     * @throws EE_Error
308
-     * @throws ReflectionException
309
-     */
310
-    public function placeholder(): string
311
-    {
312
-        return $this->get('FIN_placeholder');
313
-    }
314
-
315
-
316
-    /**
317
-     * @param string $placeholder
318
-     * @throws EE_Error
319
-     * @throws ReflectionException
320
-     */
321
-    public function setPlaceholder(string $placeholder)
322
-    {
323
-        $this->set('FIN_placeholder', $placeholder);
324
-    }
325
-
326
-
327
-    /**
328
-     * Input label displayed on public forms, ie: the actual question text.
329
-     *
330
-     * @return string
331
-     * @throws EE_Error
332
-     * @throws ReflectionException
333
-     */
334
-    public function publicLabel(): string
335
-    {
336
-        return $this->get('FIN_publicLabel');
337
-    }
338
-
339
-
340
-    /**
341
-     * @param string $publicLabel
342
-     * @throws EE_Error
343
-     * @throws ReflectionException
344
-     */
345
-    public function setPublicLabel(string $publicLabel)
346
-    {
347
-        $this->set('FIN_publicLabel', $publicLabel);
348
-    }
349
-
350
-
351
-    /**
352
-     * Whether or not the input must be supplied with a value in order to complete the form.
353
-     *
354
-     * @return bool
355
-     * @throws EE_Error
356
-     * @throws ReflectionException
357
-     */
358
-    public function required(): bool
359
-    {
360
-        return $this->get('FIN_required');
361
-    }
362
-
363
-
364
-    /**
365
-     * @param bool $required
366
-     * @throws EE_Error
367
-     * @throws ReflectionException
368
-     */
369
-    public function setRequired(bool $required)
370
-    {
371
-        $this->set('FIN_required', $required);
372
-    }
373
-
374
-
375
-    /**
376
-     * Custom validation text displayed alongside a required form input to assist users with completing the form.
377
-     *
378
-     * @return string
379
-     * @throws EE_Error
380
-     * @throws ReflectionException
381
-     */
382
-    public function requiredText(): string
383
-    {
384
-        return $this->get('FIN_requiredText');
385
-    }
386
-
387
-
388
-    /**
389
-     * @param string $requiredText
390
-     * @throws EE_Error
391
-     * @throws ReflectionException
392
-     */
393
-    public function setRequiredText(string $requiredText)
394
-    {
395
-        $this->set('FIN_requiredText', $requiredText);
396
-    }
397
-
398
-
399
-    /**
400
-     * Whether form input is active, archived, trashed, or used as a default on new forms.
401
-     * Values correspond to the EEM_Form_Input::STATUS_* constants.
402
-     *
403
-     * @return string
404
-     * @throws EE_Error
405
-     * @throws ReflectionException
406
-     */
407
-    public function status(): string
408
-    {
409
-        return $this->get('FIN_status');
410
-    }
411
-
412
-
413
-    /**
414
-     * Whether form input is active, archived, trashed, or used as a default on new forms.
415
-     * Values correspond to the EEM_Form_Input::STATUS_* constants.
416
-     *
417
-     * @param string $status
418
-     * @throws EE_Error
419
-     * @throws ReflectionException
420
-     */
421
-    public function setStatus(string $status)
422
-    {
423
-        $this->set('FIN_status', $status);
424
-    }
425
-
426
-
427
-    /**
428
-     * Form input type.
429
-     * Values correspond to the EventEspresso\core\domain\entities\form\Input::TYPE_* constants.
430
-     *
431
-     * @return string
432
-     * @throws EE_Error
433
-     * @throws ReflectionException
434
-     */
435
-    public function type(): string
436
-    {
437
-        return $this->get('FIN_type');
438
-    }
439
-
440
-
441
-    /**
442
-     * @param string $type
443
-     * @throws EE_Error
444
-     * @throws ReflectionException
445
-     */
446
-    public function setType(string $type)
447
-    {
448
-        $this->set('FIN_type', $type);
449
-    }
450
-
451
-
452
-    /**
453
-     * ID of the WP User that created this form input.
454
-     *
455
-     * @return int
456
-     * @throws EE_Error
457
-     * @throws ReflectionException
458
-     */
459
-    public function wpUser(): int
460
-    {
461
-        return $this->get('FIN_wpUser');
462
-    }
463
-
464
-
465
-    /**
466
-     * returns the id the wordpress user who created this question
467
-     *
468
-     * @param int $wp_user
469
-     * @throws EE_Error
470
-     * @throws ReflectionException
471
-     */
472
-    public function setWpUser(int $wp_user)
473
-    {
474
-        $this->set('FIN_wpUser', $wp_user);
475
-    }
31
+	/**
32
+	 * @param array $props_n_values
33
+	 * @return EE_Form_Input
34
+	 * @throws EE_Error
35
+	 * @throws ReflectionException
36
+	 */
37
+	public static function new_instance(array $props_n_values = []): EE_Form_Input
38
+	{
39
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__);
40
+		return $has_object
41
+			?: new self($props_n_values);
42
+	}
43
+
44
+
45
+	/**
46
+	 * @param array $props_n_values
47
+	 * @return EE_Form_Input
48
+	 * @throws EE_Error
49
+	 * @throws ReflectionException
50
+	 */
51
+	public static function new_instance_from_db(array $props_n_values = []): EE_Form_Input
52
+	{
53
+		return new self($props_n_values);
54
+	}
55
+
56
+
57
+	/**
58
+	 * Form Input UUID (universally unique identifier)
59
+	 *
60
+	 * @return string
61
+	 * @throws EE_Error
62
+	 * @throws ReflectionException
63
+	 */
64
+	public function UUID(): string
65
+	{
66
+		return $this->get('FIN_UUID');
67
+	}
68
+
69
+
70
+	/**
71
+	 * @param string $UUID
72
+	 * @throws EE_Error
73
+	 * @throws ReflectionException
74
+	 */
75
+	public function setUUID(string $UUID)
76
+	{
77
+		$this->set('FIN_UUID', $UUID);
78
+	}
79
+
80
+
81
+	/**
82
+	 * Input label displayed in the admin to help differentiate input from others
83
+	 *
84
+	 * @return string
85
+	 * @throws EE_Error
86
+	 * @throws ReflectionException
87
+	 */
88
+	public function adminLabel(): string
89
+	{
90
+		return $this->get('FIN_adminLabel');
91
+	}
92
+
93
+
94
+	/**
95
+	 * @param string $admin_label
96
+	 * @throws EE_Error
97
+	 * @throws ReflectionException
98
+	 */
99
+	public function setAdminLabel(string $admin_label)
100
+	{
101
+		$this->set('FIN_adminLabel', $admin_label);
102
+	}
103
+
104
+
105
+	/**
106
+	 * Whether or not input is only displayed in the admin. If false, input will appear in public forms
107
+	 *
108
+	 * @return bool
109
+	 * @throws EE_Error
110
+	 * @throws ReflectionException
111
+	 */
112
+	public function adminOnly(): bool
113
+	{
114
+		return $this->get('FIN_adminOnly');
115
+	}
116
+
117
+
118
+	/**
119
+	 * @param bool $admin_only
120
+	 * @throws EE_Error
121
+	 * @throws ReflectionException
122
+	 */
123
+	public function setAdminOnly(bool $admin_only)
124
+	{
125
+		$this->set('FIN_adminOnly', $admin_only);
126
+	}
127
+
128
+
129
+	/**
130
+	 * UUID of parent form section this form input belongs to.
131
+	 *
132
+	 * @return string
133
+	 * @throws EE_Error
134
+	 * @throws ReflectionException
135
+	 */
136
+	public function belongsTo(): string
137
+	{
138
+		return $this->get('FIN_belongsTo');
139
+	}
140
+
141
+
142
+	/**
143
+	 * @param string $relation_UUID
144
+	 * @throws EE_Error
145
+	 * @throws ReflectionException
146
+	 */
147
+	public function setBelongsTo(string $relation_UUID)
148
+	{
149
+		$this->set('FIN_belongsTo', $relation_UUID);
150
+	}
151
+
152
+
153
+	/**
154
+	 * Custom HTML classes to be applied to this form input's help text.
155
+	 *
156
+	 * @return string
157
+	 * @throws EE_Error
158
+	 * @throws ReflectionException
159
+	 */
160
+	public function helpClass(): string
161
+	{
162
+		return $this->get('FIN_helpClass');
163
+	}
164
+
165
+
166
+	/**
167
+	 * @param string $help_class
168
+	 * @throws EE_Error
169
+	 * @throws ReflectionException
170
+	 */
171
+	public function setHelpClass(string $help_class)
172
+	{
173
+		$this->set('FIN_helpClass', $help_class);
174
+	}
175
+
176
+
177
+	/**
178
+	 * Additional text displayed alongside a form input to assist users with completing the form.
179
+	 *
180
+	 * @return string
181
+	 * @throws EE_Error
182
+	 * @throws ReflectionException
183
+	 */
184
+	public function helpText(): string
185
+	{
186
+		return $this->get('FIN_helpText');
187
+	}
188
+
189
+
190
+	/**
191
+	 * @param string $help_text
192
+	 * @throws EE_Error
193
+	 * @throws ReflectionException
194
+	 */
195
+	public function setHelpText(string $help_text)
196
+	{
197
+		$this->set('FIN_helpText', $help_text);
198
+	}
199
+
200
+
201
+	/**
202
+	 * HTML classes to be applied to this form input's container.
203
+	 *
204
+	 * @return string
205
+	 * @throws EE_Error
206
+	 * @throws ReflectionException
207
+	 */
208
+	public function htmlClass(): string
209
+	{
210
+		return $this->get('FIN_htmlClass');
211
+	}
212
+
213
+
214
+	/**
215
+	 * HTML classes to be applied to this form input's container.
216
+	 *
217
+	 * @param string $html_class
218
+	 * @throws EE_Error
219
+	 * @throws ReflectionException
220
+	 */
221
+	public function setHtmlClass(string $html_class)
222
+	{
223
+		$this->set('FIN_htmlClass', $html_class);
224
+	}
225
+
226
+
227
+	/**
228
+	 * Maximum numeric value or maximum characters allowed for form input answer.
229
+	 *
230
+	 * @return int
231
+	 * @throws EE_Error
232
+	 * @throws ReflectionException
233
+	 */
234
+	public function max(): int
235
+	{
236
+		return $this->get('FIN_max');
237
+	}
238
+
239
+
240
+	/**
241
+	 * @param int $max
242
+	 * @throws EE_Error
243
+	 * @throws ReflectionException
244
+	 */
245
+	public function setMax(int $max)
246
+	{
247
+		$this->set('FIN_max', $max);
248
+	}
249
+
250
+
251
+
252
+	/**
253
+	 * Minimum numeric value or minimum characters allowed for form input answer.
254
+	 *
255
+	 * @return int
256
+	 * @throws EE_Error
257
+	 * @throws ReflectionException
258
+	 */
259
+	public function min(): int
260
+	{
261
+		return $this->get('FIN_min');
262
+	}
263
+
264
+
265
+	/**
266
+	 * @param int $min
267
+	 * @throws EE_Error
268
+	 * @throws ReflectionException
269
+	 */
270
+	public function setMin(int $min)
271
+	{
272
+		$this->set('FIN_min', $min);
273
+	}
274
+
275
+
276
+
277
+	/**
278
+	 * Order in which form input appears in a form.
279
+	 *
280
+	 * @return int
281
+	 * @throws EE_Error
282
+	 * @throws ReflectionException
283
+	 */
284
+	public function order(): int
285
+	{
286
+		return $this->get('FIN_order');
287
+	}
288
+
289
+
290
+	/**
291
+	 * Order in which form input appears in a form.
292
+	 *
293
+	 * @param int $order
294
+	 * @throws EE_Error
295
+	 * @throws ReflectionException
296
+	 */
297
+	public function setOrder(int $order)
298
+	{
299
+		$this->set('FIN_order', $order);
300
+	}
301
+
302
+
303
+	/**
304
+	 * Example text displayed within an input to assist users with completing the form.
305
+	 *
306
+	 * @return string
307
+	 * @throws EE_Error
308
+	 * @throws ReflectionException
309
+	 */
310
+	public function placeholder(): string
311
+	{
312
+		return $this->get('FIN_placeholder');
313
+	}
314
+
315
+
316
+	/**
317
+	 * @param string $placeholder
318
+	 * @throws EE_Error
319
+	 * @throws ReflectionException
320
+	 */
321
+	public function setPlaceholder(string $placeholder)
322
+	{
323
+		$this->set('FIN_placeholder', $placeholder);
324
+	}
325
+
326
+
327
+	/**
328
+	 * Input label displayed on public forms, ie: the actual question text.
329
+	 *
330
+	 * @return string
331
+	 * @throws EE_Error
332
+	 * @throws ReflectionException
333
+	 */
334
+	public function publicLabel(): string
335
+	{
336
+		return $this->get('FIN_publicLabel');
337
+	}
338
+
339
+
340
+	/**
341
+	 * @param string $publicLabel
342
+	 * @throws EE_Error
343
+	 * @throws ReflectionException
344
+	 */
345
+	public function setPublicLabel(string $publicLabel)
346
+	{
347
+		$this->set('FIN_publicLabel', $publicLabel);
348
+	}
349
+
350
+
351
+	/**
352
+	 * Whether or not the input must be supplied with a value in order to complete the form.
353
+	 *
354
+	 * @return bool
355
+	 * @throws EE_Error
356
+	 * @throws ReflectionException
357
+	 */
358
+	public function required(): bool
359
+	{
360
+		return $this->get('FIN_required');
361
+	}
362
+
363
+
364
+	/**
365
+	 * @param bool $required
366
+	 * @throws EE_Error
367
+	 * @throws ReflectionException
368
+	 */
369
+	public function setRequired(bool $required)
370
+	{
371
+		$this->set('FIN_required', $required);
372
+	}
373
+
374
+
375
+	/**
376
+	 * Custom validation text displayed alongside a required form input to assist users with completing the form.
377
+	 *
378
+	 * @return string
379
+	 * @throws EE_Error
380
+	 * @throws ReflectionException
381
+	 */
382
+	public function requiredText(): string
383
+	{
384
+		return $this->get('FIN_requiredText');
385
+	}
386
+
387
+
388
+	/**
389
+	 * @param string $requiredText
390
+	 * @throws EE_Error
391
+	 * @throws ReflectionException
392
+	 */
393
+	public function setRequiredText(string $requiredText)
394
+	{
395
+		$this->set('FIN_requiredText', $requiredText);
396
+	}
397
+
398
+
399
+	/**
400
+	 * Whether form input is active, archived, trashed, or used as a default on new forms.
401
+	 * Values correspond to the EEM_Form_Input::STATUS_* constants.
402
+	 *
403
+	 * @return string
404
+	 * @throws EE_Error
405
+	 * @throws ReflectionException
406
+	 */
407
+	public function status(): string
408
+	{
409
+		return $this->get('FIN_status');
410
+	}
411
+
412
+
413
+	/**
414
+	 * Whether form input is active, archived, trashed, or used as a default on new forms.
415
+	 * Values correspond to the EEM_Form_Input::STATUS_* constants.
416
+	 *
417
+	 * @param string $status
418
+	 * @throws EE_Error
419
+	 * @throws ReflectionException
420
+	 */
421
+	public function setStatus(string $status)
422
+	{
423
+		$this->set('FIN_status', $status);
424
+	}
425
+
426
+
427
+	/**
428
+	 * Form input type.
429
+	 * Values correspond to the EventEspresso\core\domain\entities\form\Input::TYPE_* constants.
430
+	 *
431
+	 * @return string
432
+	 * @throws EE_Error
433
+	 * @throws ReflectionException
434
+	 */
435
+	public function type(): string
436
+	{
437
+		return $this->get('FIN_type');
438
+	}
439
+
440
+
441
+	/**
442
+	 * @param string $type
443
+	 * @throws EE_Error
444
+	 * @throws ReflectionException
445
+	 */
446
+	public function setType(string $type)
447
+	{
448
+		$this->set('FIN_type', $type);
449
+	}
450
+
451
+
452
+	/**
453
+	 * ID of the WP User that created this form input.
454
+	 *
455
+	 * @return int
456
+	 * @throws EE_Error
457
+	 * @throws ReflectionException
458
+	 */
459
+	public function wpUser(): int
460
+	{
461
+		return $this->get('FIN_wpUser');
462
+	}
463
+
464
+
465
+	/**
466
+	 * returns the id the wordpress user who created this question
467
+	 *
468
+	 * @param int $wp_user
469
+	 * @throws EE_Error
470
+	 * @throws ReflectionException
471
+	 */
472
+	public function setWpUser(int $wp_user)
473
+	{
474
+		$this->set('FIN_wpUser', $wp_user);
475
+	}
476 476
 }
Please login to merge, or discard this patch.
core/db_classes/EE_Form_Section.class.php 1 patch
Indentation   +221 added lines, -221 removed lines patch added patch discarded remove patch
@@ -19,225 +19,225 @@
 block discarded – undo
19 19
 class EE_Form_Section extends EE_Base_Class
20 20
 {
21 21
 
22
-    /**
23
-     * @param array $props_n_values
24
-     * @return EE_Form_Section
25
-     * @throws EE_Error
26
-     * @throws ReflectionException
27
-     */
28
-    public static function new_instance(array $props_n_values = []): EE_Form_Section
29
-    {
30
-        $has_object = parent::_check_for_object($props_n_values, __CLASS__);
31
-        return $has_object
32
-            ?: new self($props_n_values);
33
-    }
34
-
35
-
36
-    /**
37
-     * @param array $props_n_values
38
-     * @return EE_Form_Section
39
-     * @throws EE_Error
40
-     * @throws ReflectionException
41
-     */
42
-    public static function new_instance_from_db(array $props_n_values = []): EE_Form_Section
43
-    {
44
-        return new self($props_n_values);
45
-    }
46
-
47
-
48
-    /**
49
-     * Form Section UUID (universally unique identifier)
50
-     *
51
-     * @return string
52
-     * @throws EE_Error
53
-     * @throws ReflectionException
54
-     */
55
-    public function UUID(): string
56
-    {
57
-        return $this->get('FSC_UUID');
58
-    }
59
-
60
-
61
-    /**
62
-     * @param string $UUID
63
-     * @throws EE_Error
64
-     * @throws ReflectionException
65
-     */
66
-    public function setUUID(string $UUID)
67
-    {
68
-        $this->set('FSC_UUID', $UUID);
69
-    }
70
-
71
-
72
-    /**
73
-     * Form user types that this form section should be presented to.
74
-     * Values correspond to the EEM_Form_Section::APPLIES_TO_* constants.
75
-     *
76
-     * @return string
77
-     * @throws EE_Error
78
-     * @throws ReflectionException
79
-     */
80
-    public function appliesTo(): string
81
-    {
82
-        return $this->get('FSC_appliesTo');
83
-    }
84
-
85
-
86
-    /**
87
-     * @param string $user_type
88
-     * @throws EE_Error
89
-     * @throws ReflectionException
90
-     */
91
-    public function setAppliesTo(string $user_type)
92
-    {
93
-        $this->set('FSC_appliesTo', $user_type);
94
-    }
95
-
96
-
97
-    /**
98
-     * UUID or ID of related entity this form section belongs to.
99
-     *
100
-     * @return string
101
-     * @throws EE_Error
102
-     * @throws ReflectionException
103
-     */
104
-    public function belongsTo(): string
105
-    {
106
-        return $this->get('FSC_belongsTo');
107
-    }
108
-
109
-
110
-    /**
111
-     * @param string $relation_UUID
112
-     * @throws EE_Error
113
-     * @throws ReflectionException
114
-     */
115
-    public function setBelongsTo(string $relation_UUID)
116
-    {
117
-        $this->set('FSC_belongsTo', $relation_UUID);
118
-    }
119
-
120
-
121
-    /**
122
-     * HTML classes to be applied to this form section's container.
123
-     *
124
-     * @return string
125
-     * @throws EE_Error
126
-     * @throws ReflectionException
127
-     */
128
-    public function htmlClass(): string
129
-    {
130
-        return $this->get('FSC_htmlClass');
131
-    }
132
-
133
-
134
-    /**
135
-     * @param string $html_class
136
-     * @throws EE_Error
137
-     * @throws ReflectionException
138
-     */
139
-    public function setHtmlClass(string $html_class)
140
-    {
141
-        $this->set('FSC_htmlClass', $html_class);
142
-    }
143
-
144
-
145
-    /**
146
-     * Order in which form section appears in a form.
147
-     *
148
-     * @return int
149
-     * @throws EE_Error
150
-     * @throws ReflectionException
151
-     */
152
-    public function order(): int
153
-    {
154
-        return $this->get('FSC_order');
155
-    }
156
-
157
-
158
-    /**
159
-     * @param int $order
160
-     * @throws EE_Error
161
-     * @throws ReflectionException
162
-     */
163
-    public function setOrder(int $order)
164
-    {
165
-        $this->set('FSC_order', $order);
166
-    }
167
-
168
-
169
-    /**
170
-     * Related model type.
171
-     *
172
-     * @return string
173
-     * @throws EE_Error
174
-     * @throws ReflectionException
175
-     */
176
-    public function relation(): string
177
-    {
178
-        return $this->get('FSC_relation');
179
-    }
180
-
181
-
182
-    /**
183
-     * @param string $relation
184
-     * @throws EE_Error
185
-     * @throws ReflectionException
186
-     */
187
-    public function setRelation(string $relation)
188
-    {
189
-        $this->set('FSC_relation', $relation);
190
-    }
191
-
192
-
193
-    /**
194
-     * Whether form section is active, archived, trashed, or used as a default on new forms.
195
-     * Values correspond to the EEM_Form_Section::STATUS_* constants.
196
-     *
197
-     * @return string
198
-     * @throws EE_Error
199
-     * @throws ReflectionException
200
-     */
201
-    public function status(): string
202
-    {
203
-        return $this->get('FSC_status');
204
-    }
205
-
206
-
207
-    /**
208
-     * Whether form section is active, archived, trashed, or used as a default on new forms.
209
-     * Values correspond to the EEM_Form_Section::STATUS_* constants.
210
-     *
211
-     * @param string $status
212
-     * @throws EE_Error
213
-     * @throws ReflectionException
214
-     */
215
-    public function setStatus(string $status)
216
-    {
217
-        $this->set('FSC_status', $status);
218
-    }
219
-
220
-
221
-    /**
222
-     * returns the id the wordpress user who created this question
223
-     *
224
-     * @return int
225
-     * @throws EE_Error
226
-     * @throws ReflectionException
227
-     */
228
-    public function wpUser(): int
229
-    {
230
-        return $this->get('FSC_wpUser');
231
-    }
232
-
233
-
234
-    /**
235
-     * @param int $wp_user
236
-     * @throws EE_Error
237
-     * @throws ReflectionException
238
-     */
239
-    public function setWpUser(int $wp_user)
240
-    {
241
-        $this->set('FSC_wpUser', $wp_user);
242
-    }
22
+	/**
23
+	 * @param array $props_n_values
24
+	 * @return EE_Form_Section
25
+	 * @throws EE_Error
26
+	 * @throws ReflectionException
27
+	 */
28
+	public static function new_instance(array $props_n_values = []): EE_Form_Section
29
+	{
30
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__);
31
+		return $has_object
32
+			?: new self($props_n_values);
33
+	}
34
+
35
+
36
+	/**
37
+	 * @param array $props_n_values
38
+	 * @return EE_Form_Section
39
+	 * @throws EE_Error
40
+	 * @throws ReflectionException
41
+	 */
42
+	public static function new_instance_from_db(array $props_n_values = []): EE_Form_Section
43
+	{
44
+		return new self($props_n_values);
45
+	}
46
+
47
+
48
+	/**
49
+	 * Form Section UUID (universally unique identifier)
50
+	 *
51
+	 * @return string
52
+	 * @throws EE_Error
53
+	 * @throws ReflectionException
54
+	 */
55
+	public function UUID(): string
56
+	{
57
+		return $this->get('FSC_UUID');
58
+	}
59
+
60
+
61
+	/**
62
+	 * @param string $UUID
63
+	 * @throws EE_Error
64
+	 * @throws ReflectionException
65
+	 */
66
+	public function setUUID(string $UUID)
67
+	{
68
+		$this->set('FSC_UUID', $UUID);
69
+	}
70
+
71
+
72
+	/**
73
+	 * Form user types that this form section should be presented to.
74
+	 * Values correspond to the EEM_Form_Section::APPLIES_TO_* constants.
75
+	 *
76
+	 * @return string
77
+	 * @throws EE_Error
78
+	 * @throws ReflectionException
79
+	 */
80
+	public function appliesTo(): string
81
+	{
82
+		return $this->get('FSC_appliesTo');
83
+	}
84
+
85
+
86
+	/**
87
+	 * @param string $user_type
88
+	 * @throws EE_Error
89
+	 * @throws ReflectionException
90
+	 */
91
+	public function setAppliesTo(string $user_type)
92
+	{
93
+		$this->set('FSC_appliesTo', $user_type);
94
+	}
95
+
96
+
97
+	/**
98
+	 * UUID or ID of related entity this form section belongs to.
99
+	 *
100
+	 * @return string
101
+	 * @throws EE_Error
102
+	 * @throws ReflectionException
103
+	 */
104
+	public function belongsTo(): string
105
+	{
106
+		return $this->get('FSC_belongsTo');
107
+	}
108
+
109
+
110
+	/**
111
+	 * @param string $relation_UUID
112
+	 * @throws EE_Error
113
+	 * @throws ReflectionException
114
+	 */
115
+	public function setBelongsTo(string $relation_UUID)
116
+	{
117
+		$this->set('FSC_belongsTo', $relation_UUID);
118
+	}
119
+
120
+
121
+	/**
122
+	 * HTML classes to be applied to this form section's container.
123
+	 *
124
+	 * @return string
125
+	 * @throws EE_Error
126
+	 * @throws ReflectionException
127
+	 */
128
+	public function htmlClass(): string
129
+	{
130
+		return $this->get('FSC_htmlClass');
131
+	}
132
+
133
+
134
+	/**
135
+	 * @param string $html_class
136
+	 * @throws EE_Error
137
+	 * @throws ReflectionException
138
+	 */
139
+	public function setHtmlClass(string $html_class)
140
+	{
141
+		$this->set('FSC_htmlClass', $html_class);
142
+	}
143
+
144
+
145
+	/**
146
+	 * Order in which form section appears in a form.
147
+	 *
148
+	 * @return int
149
+	 * @throws EE_Error
150
+	 * @throws ReflectionException
151
+	 */
152
+	public function order(): int
153
+	{
154
+		return $this->get('FSC_order');
155
+	}
156
+
157
+
158
+	/**
159
+	 * @param int $order
160
+	 * @throws EE_Error
161
+	 * @throws ReflectionException
162
+	 */
163
+	public function setOrder(int $order)
164
+	{
165
+		$this->set('FSC_order', $order);
166
+	}
167
+
168
+
169
+	/**
170
+	 * Related model type.
171
+	 *
172
+	 * @return string
173
+	 * @throws EE_Error
174
+	 * @throws ReflectionException
175
+	 */
176
+	public function relation(): string
177
+	{
178
+		return $this->get('FSC_relation');
179
+	}
180
+
181
+
182
+	/**
183
+	 * @param string $relation
184
+	 * @throws EE_Error
185
+	 * @throws ReflectionException
186
+	 */
187
+	public function setRelation(string $relation)
188
+	{
189
+		$this->set('FSC_relation', $relation);
190
+	}
191
+
192
+
193
+	/**
194
+	 * Whether form section is active, archived, trashed, or used as a default on new forms.
195
+	 * Values correspond to the EEM_Form_Section::STATUS_* constants.
196
+	 *
197
+	 * @return string
198
+	 * @throws EE_Error
199
+	 * @throws ReflectionException
200
+	 */
201
+	public function status(): string
202
+	{
203
+		return $this->get('FSC_status');
204
+	}
205
+
206
+
207
+	/**
208
+	 * Whether form section is active, archived, trashed, or used as a default on new forms.
209
+	 * Values correspond to the EEM_Form_Section::STATUS_* constants.
210
+	 *
211
+	 * @param string $status
212
+	 * @throws EE_Error
213
+	 * @throws ReflectionException
214
+	 */
215
+	public function setStatus(string $status)
216
+	{
217
+		$this->set('FSC_status', $status);
218
+	}
219
+
220
+
221
+	/**
222
+	 * returns the id the wordpress user who created this question
223
+	 *
224
+	 * @return int
225
+	 * @throws EE_Error
226
+	 * @throws ReflectionException
227
+	 */
228
+	public function wpUser(): int
229
+	{
230
+		return $this->get('FSC_wpUser');
231
+	}
232
+
233
+
234
+	/**
235
+	 * @param int $wp_user
236
+	 * @throws EE_Error
237
+	 * @throws ReflectionException
238
+	 */
239
+	public function setWpUser(int $wp_user)
240
+	{
241
+		$this->set('FSC_wpUser', $wp_user);
242
+	}
243 243
 }
Please login to merge, or discard this patch.