Completed
Branch master (59af22)
by
unknown
07:35 queued 03:06
created
core/domain/services/graphql/types/FormElement.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
      */
35 35
     public function __construct(EEM_Form_Element $form_element_model)
36 36
     {
37
-        $this->setName($this->namespace . 'FormElement');
37
+        $this->setName($this->namespace.'FormElement');
38 38
         $this->setDescription(__('A form element', 'event_espresso'));
39 39
         $this->setIsCustomPostType(false);
40 40
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
             ),
134 134
             new GraphQLField(
135 135
                 'status',
136
-                $this->namespace . 'FormStatusEnum',
136
+                $this->namespace.'FormStatusEnum',
137 137
                 'status',
138 138
                 esc_html__(
139 139
                     'Whether form element is active, archived, trashed, or used as a default on new forms.',
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
             ),
143 143
             new GraphQLField(
144 144
                 'type',
145
-                $this->namespace . 'ElementTypeEnum',
145
+                $this->namespace.'ElementTypeEnum',
146 146
                 'type',
147 147
                 esc_html__('Form element type.', 'event_espresso')
148 148
             ),
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
     {
181 181
         // Register mutation to update an entity.
182 182
         register_graphql_mutation(
183
-            'update' . $this->name(),
183
+            'update'.$this->name(),
184 184
             [
185 185
                 'inputFields'         => $inputFields,
186 186
                 'outputFields'        => [
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
         );
195 195
         // Register mutation to delete an entity.
196 196
         register_graphql_mutation(
197
-            'delete' . $this->name(),
197
+            'delete'.$this->name(),
198 198
             [
199 199
                 'inputFields'         => [
200 200
                     'id' => $inputFields['id'],
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
                     lcfirst($this->name()) => [
204 204
                         'type'        => $this->name(),
205 205
                         'description' => esc_html__('The object before it was deleted', 'event_espresso'),
206
-                        'resolve'     => static function ($payload) {
206
+                        'resolve'     => static function($payload) {
207 207
                             $deleted = (object) $payload['deleted'];
208 208
 
209 209
                             return ! empty($deleted) ? $deleted : null;
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 
221 221
         // Register mutation to update an entity.
222 222
         register_graphql_mutation(
223
-            'create' . $this->name(),
223
+            'create'.$this->name(),
224 224
             [
225 225
                 'inputFields'         => $inputFields,
226 226
                 'outputFields'        => [
Please login to merge, or discard this patch.
Indentation   +197 added lines, -197 removed lines patch added patch discarded remove patch
@@ -26,210 +26,210 @@
 block discarded – undo
26 26
  */
27 27
 class FormElement extends TypeBase
28 28
 {
29
-    /**
30
-     * FormElement constructor.
31
-     *
32
-     * @param EEM_Form_Element $form_element_model
33
-     */
34
-    public function __construct(EEM_Form_Element $form_element_model)
35
-    {
36
-        $this->setName($this->namespace . 'FormElement');
37
-        $this->setDescription(__('A form element', 'event_espresso'));
38
-        $this->setIsCustomPostType(false);
29
+	/**
30
+	 * FormElement constructor.
31
+	 *
32
+	 * @param EEM_Form_Element $form_element_model
33
+	 */
34
+	public function __construct(EEM_Form_Element $form_element_model)
35
+	{
36
+		$this->setName($this->namespace . 'FormElement');
37
+		$this->setDescription(__('A form element', 'event_espresso'));
38
+		$this->setIsCustomPostType(false);
39 39
 
40
-        parent::__construct($form_element_model);
41
-    }
40
+		parent::__construct($form_element_model);
41
+	}
42 42
 
43 43
 
44
-    /**
45
-     * @return GraphQLFieldInterface[]
46
-     */
47
-    public function getFields(): array
48
-    {
49
-        $fields = [
50
-            new GraphQLField(
51
-                'id',
52
-                ['non_null' => 'ID'],
53
-                null,
54
-                esc_html__('The globally unique ID for the object.', 'event_espresso')
55
-            ),
56
-            new GraphQLField(
57
-                'adminOnly',
58
-                'Boolean',
59
-                'adminOnly',
60
-                esc_html__(
61
-                    'Whether or not the element is only displayed in the admin. If false, input will appear in public forms',
62
-                    'event_espresso'
63
-                )
64
-            ),
65
-            new GraphQLField(
66
-                'attributes',
67
-                'String',
68
-                'attributes',
69
-                esc_html__(
70
-                    'JSON string of HTML attributes such as class, max, min, placeholder, type, etc.',
71
-                    'event_espresso'
72
-                ),
73
-                [$this, 'toJson']
74
-            ),
75
-            new GraphQLField(
76
-                'belongsTo',
77
-                'String',
78
-                'belongsTo',
79
-                esc_html__('UUID of parent form section this form element belongs to.', 'event_espresso')
80
-            ),
81
-            new GraphQLField(
82
-                'helpText',
83
-                'String',
84
-                'helpText',
85
-                esc_html__(
86
-                    "JSON string of properties pertaining to any help text required for an input.",
87
-                    'event_espresso'
88
-                ),
89
-                [$this, 'toJson']
90
-            ),
91
-            new GraphQLField(
92
-                'label',
93
-                'String',
94
-                'label',
95
-                esc_html__(
96
-                    'JSON string of properties pertaining to an element\'s label.',
97
-                    'event_espresso'
98
-                ),
99
-                [$this, 'toJson']
100
-            ),
101
-            new GraphQLField(
102
-                'mapsTo',
103
-                'String',
104
-                'mapsTo',
105
-                esc_html__("Model and Fields name that this element maps to; ex: Attendee.email", 'event_espresso')
106
-            ),
107
-            new GraphQLField(
108
-                'options',
109
-                'String',
110
-                'options',
111
-                esc_html__(
112
-                    "JSON string of options for ENUM type inputs like checkboxes, radio buttons, select inputs, etc.",
113
-                    'event_espresso'
114
-                ),
115
-                [$this, 'toJson']
116
-            ),
117
-            new GraphQLField(
118
-                'order',
119
-                'Int',
120
-                'order',
121
-                esc_html__('Order in which form element appears in a form.', 'event_espresso')
122
-            ),
123
-            new GraphQLField(
124
-                'required',
125
-                'String',
126
-                'required',
127
-                esc_html__(
128
-                    "properties pertaining to an input\'s required status and the validation text to display.",
129
-                    'event_espresso'
130
-                ),
131
-                [$this, 'toJson']
132
-            ),
133
-            new GraphQLField(
134
-                'status',
135
-                $this->namespace . 'FormStatusEnum',
136
-                'status',
137
-                esc_html__(
138
-                    'Whether form element is active, archived, trashed, or used as a default on new forms.',
139
-                    'event_espresso'
140
-                )
141
-            ),
142
-            new GraphQLField(
143
-                'type',
144
-                $this->namespace . 'ElementTypeEnum',
145
-                'type',
146
-                esc_html__('Form element type.', 'event_espresso')
147
-            ),
148
-            new GraphQLOutputField(
149
-                'wpUser',
150
-                'User',
151
-                null,
152
-                esc_html__('WP User that created this form element.', 'event_espresso')
153
-            ),
154
-            new GraphQLInputField(
155
-                'wpUser',
156
-                'ID',
157
-                null,
158
-                esc_html__('ID of the WP User that created the form element.', 'event_espresso')
159
-            ),
160
-        ];
44
+	/**
45
+	 * @return GraphQLFieldInterface[]
46
+	 */
47
+	public function getFields(): array
48
+	{
49
+		$fields = [
50
+			new GraphQLField(
51
+				'id',
52
+				['non_null' => 'ID'],
53
+				null,
54
+				esc_html__('The globally unique ID for the object.', 'event_espresso')
55
+			),
56
+			new GraphQLField(
57
+				'adminOnly',
58
+				'Boolean',
59
+				'adminOnly',
60
+				esc_html__(
61
+					'Whether or not the element is only displayed in the admin. If false, input will appear in public forms',
62
+					'event_espresso'
63
+				)
64
+			),
65
+			new GraphQLField(
66
+				'attributes',
67
+				'String',
68
+				'attributes',
69
+				esc_html__(
70
+					'JSON string of HTML attributes such as class, max, min, placeholder, type, etc.',
71
+					'event_espresso'
72
+				),
73
+				[$this, 'toJson']
74
+			),
75
+			new GraphQLField(
76
+				'belongsTo',
77
+				'String',
78
+				'belongsTo',
79
+				esc_html__('UUID of parent form section this form element belongs to.', 'event_espresso')
80
+			),
81
+			new GraphQLField(
82
+				'helpText',
83
+				'String',
84
+				'helpText',
85
+				esc_html__(
86
+					"JSON string of properties pertaining to any help text required for an input.",
87
+					'event_espresso'
88
+				),
89
+				[$this, 'toJson']
90
+			),
91
+			new GraphQLField(
92
+				'label',
93
+				'String',
94
+				'label',
95
+				esc_html__(
96
+					'JSON string of properties pertaining to an element\'s label.',
97
+					'event_espresso'
98
+				),
99
+				[$this, 'toJson']
100
+			),
101
+			new GraphQLField(
102
+				'mapsTo',
103
+				'String',
104
+				'mapsTo',
105
+				esc_html__("Model and Fields name that this element maps to; ex: Attendee.email", 'event_espresso')
106
+			),
107
+			new GraphQLField(
108
+				'options',
109
+				'String',
110
+				'options',
111
+				esc_html__(
112
+					"JSON string of options for ENUM type inputs like checkboxes, radio buttons, select inputs, etc.",
113
+					'event_espresso'
114
+				),
115
+				[$this, 'toJson']
116
+			),
117
+			new GraphQLField(
118
+				'order',
119
+				'Int',
120
+				'order',
121
+				esc_html__('Order in which form element appears in a form.', 'event_espresso')
122
+			),
123
+			new GraphQLField(
124
+				'required',
125
+				'String',
126
+				'required',
127
+				esc_html__(
128
+					"properties pertaining to an input\'s required status and the validation text to display.",
129
+					'event_espresso'
130
+				),
131
+				[$this, 'toJson']
132
+			),
133
+			new GraphQLField(
134
+				'status',
135
+				$this->namespace . 'FormStatusEnum',
136
+				'status',
137
+				esc_html__(
138
+					'Whether form element is active, archived, trashed, or used as a default on new forms.',
139
+					'event_espresso'
140
+				)
141
+			),
142
+			new GraphQLField(
143
+				'type',
144
+				$this->namespace . 'ElementTypeEnum',
145
+				'type',
146
+				esc_html__('Form element type.', 'event_espresso')
147
+			),
148
+			new GraphQLOutputField(
149
+				'wpUser',
150
+				'User',
151
+				null,
152
+				esc_html__('WP User that created this form element.', 'event_espresso')
153
+			),
154
+			new GraphQLInputField(
155
+				'wpUser',
156
+				'ID',
157
+				null,
158
+				esc_html__('ID of the WP User that created the form element.', 'event_espresso')
159
+			),
160
+		];
161 161
 
162
-        return apply_filters(
163
-            'FHEE__EventEspresso_core_domain_services_graphql_types__form_element_fields',
164
-            $fields,
165
-            $this->name,
166
-            $this->model
167
-        );
168
-    }
162
+		return apply_filters(
163
+			'FHEE__EventEspresso_core_domain_services_graphql_types__form_element_fields',
164
+			$fields,
165
+			$this->name,
166
+			$this->model
167
+		);
168
+	}
169 169
 
170 170
 
171
-    /**
172
-     * @param array $inputFields The mutation input fields.
173
-     * @throws InvalidArgumentException
174
-     * @throws ReflectionException
175
-     * @throws Exception
176
-     * @since 5.0.0.p
177
-     */
178
-    public function registerMutations(array $inputFields)
179
-    {
180
-        // Register mutation to update an entity.
181
-        register_graphql_mutation(
182
-            'update' . $this->name(),
183
-            [
184
-                'inputFields'         => $inputFields,
185
-                'outputFields'        => [
186
-                    lcfirst($this->name()) => [
187
-                        'type'    => $this->name(),
188
-                        'resolve' => [$this, 'resolveFromPayload'],
189
-                    ],
190
-                ],
191
-                'mutateAndGetPayload' => FormElementUpdate::mutateAndGetPayload($this->model),
192
-            ]
193
-        );
194
-        // Register mutation to delete an entity.
195
-        register_graphql_mutation(
196
-            'delete' . $this->name(),
197
-            [
198
-                'inputFields'         => [
199
-                    'id' => $inputFields['id'],
200
-                ],
201
-                'outputFields'        => [
202
-                    lcfirst($this->name()) => [
203
-                        'type'        => $this->name(),
204
-                        'description' => esc_html__('The object before it was deleted', 'event_espresso'),
205
-                        'resolve'     => static function ($payload) {
206
-                            $deleted = (object) $payload['deleted'];
171
+	/**
172
+	 * @param array $inputFields The mutation input fields.
173
+	 * @throws InvalidArgumentException
174
+	 * @throws ReflectionException
175
+	 * @throws Exception
176
+	 * @since 5.0.0.p
177
+	 */
178
+	public function registerMutations(array $inputFields)
179
+	{
180
+		// Register mutation to update an entity.
181
+		register_graphql_mutation(
182
+			'update' . $this->name(),
183
+			[
184
+				'inputFields'         => $inputFields,
185
+				'outputFields'        => [
186
+					lcfirst($this->name()) => [
187
+						'type'    => $this->name(),
188
+						'resolve' => [$this, 'resolveFromPayload'],
189
+					],
190
+				],
191
+				'mutateAndGetPayload' => FormElementUpdate::mutateAndGetPayload($this->model),
192
+			]
193
+		);
194
+		// Register mutation to delete an entity.
195
+		register_graphql_mutation(
196
+			'delete' . $this->name(),
197
+			[
198
+				'inputFields'         => [
199
+					'id' => $inputFields['id'],
200
+				],
201
+				'outputFields'        => [
202
+					lcfirst($this->name()) => [
203
+						'type'        => $this->name(),
204
+						'description' => esc_html__('The object before it was deleted', 'event_espresso'),
205
+						'resolve'     => static function ($payload) {
206
+							$deleted = (object) $payload['deleted'];
207 207
 
208
-                            return ! empty($deleted) ? $deleted : null;
209
-                        },
210
-                    ],
211
-                ],
212
-                'mutateAndGetPayload' => FormElementDelete::mutateAndGetPayload($this->model),
213
-            ]
214
-        );
208
+							return ! empty($deleted) ? $deleted : null;
209
+						},
210
+					],
211
+				],
212
+				'mutateAndGetPayload' => FormElementDelete::mutateAndGetPayload($this->model),
213
+			]
214
+		);
215 215
 
216
-        // Make element 'type' a required field for create mutations
217
-        // Yes it's "['type']['type']" 
Please login to merge, or discard this patch.
core/domain/services/graphql/types/FormSection.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
      */
35 35
     public function __construct(EEM_Form_Section $form_section_model)
36 36
     {
37
-        $this->setName($this->namespace . 'FormSection');
37
+        $this->setName($this->namespace.'FormSection');
38 38
         $this->setDescription(__('A form section', 'event_espresso'));
39 39
         $this->setIsCustomPostType(false);
40 40
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
             ),
57 57
             new GraphQLField(
58 58
                 'appliesTo',
59
-                $this->namespace . 'FormSectionAppliesToEnum',
59
+                $this->namespace.'FormSectionAppliesToEnum',
60 60
                 'appliesTo',
61 61
                 esc_html__('Form user type that this form section should be presented to.', 'event_espresso')
62 62
             ),
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
             ),
95 95
             new GraphQLField(
96 96
                 'status',
97
-                $this->namespace . 'FormStatusEnum',
97
+                $this->namespace.'FormStatusEnum',
98 98
                 'status',
99 99
                 esc_html__(
100 100
                     'Whether form section is active, archived, shared, trashed, or used as a default on new forms.',
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
     {
136 136
         // Register mutation to update an entity.
137 137
         register_graphql_mutation(
138
-            'update' . $this->name(),
138
+            'update'.$this->name(),
139 139
             [
140 140
                 'inputFields'         => $inputFields,
141 141
                 'outputFields'        => [
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
         );
150 150
         // Register mutation to delete an entity.
151 151
         register_graphql_mutation(
152
-            'delete' . $this->name(),
152
+            'delete'.$this->name(),
153 153
             [
154 154
                 'inputFields'         => [
155 155
                     'id' => $inputFields['id'],
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
                     lcfirst($this->name()) => [
159 159
                         'type'        => $this->name(),
160 160
                         'description' => esc_html__('The object before it was deleted', 'event_espresso'),
161
-                        'resolve'     => static function ($payload) {
161
+                        'resolve'     => static function($payload) {
162 162
                             $deleted = (object) $payload['deleted'];
163 163
 
164 164
                             return ! empty($deleted) ? $deleted : null;
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 
172 172
         // Register mutation to update an entity.
173 173
         register_graphql_mutation(
174
-            'create' . $this->name(),
174
+            'create'.$this->name(),
175 175
             [
176 176
                 'inputFields'         => $inputFields,
177 177
                 'outputFields'        => [
Please login to merge, or discard this patch.
Indentation   +179 added lines, -179 removed lines patch added patch discarded remove patch
@@ -26,191 +26,191 @@
 block discarded – undo
26 26
  */
27 27
 class FormSection extends TypeBase
28 28
 {
29
-    /**
30
-     * FormSection constructor.
31
-     *
32
-     * @param EEM_Form_Section $form_section_model
33
-     */
34
-    public function __construct(EEM_Form_Section $form_section_model)
35
-    {
36
-        $this->setName($this->namespace . 'FormSection');
37
-        $this->setDescription(__('A form section', 'event_espresso'));
38
-        $this->setIsCustomPostType(false);
29
+	/**
30
+	 * FormSection constructor.
31
+	 *
32
+	 * @param EEM_Form_Section $form_section_model
33
+	 */
34
+	public function __construct(EEM_Form_Section $form_section_model)
35
+	{
36
+		$this->setName($this->namespace . 'FormSection');
37
+		$this->setDescription(__('A form section', 'event_espresso'));
38
+		$this->setIsCustomPostType(false);
39 39
 
40
-        parent::__construct($form_section_model);
41
-    }
40
+		parent::__construct($form_section_model);
41
+	}
42 42
 
43 43
 
44
-    /**
45
-     * @return GraphQLFieldInterface[]
46
-     */
47
-    public function getFields(): array
48
-    {
49
-        $fields = [
50
-            new GraphQLField(
51
-                'id',
52
-                ['non_null' => 'ID'],
53
-                null,
54
-                esc_html__('The globally unique ID for the object.', 'event_espresso')
55
-            ),
56
-            new GraphQLField(
57
-                'appliesTo',
58
-                $this->namespace . 'FormSectionAppliesToEnum',
59
-                'appliesTo',
60
-                esc_html__('Form user type that this form section should be presented to.', 'event_espresso')
61
-            ),
62
-            new GraphQLField(
63
-                'attributes',
64
-                'String',
65
-                'attributes',
66
-                esc_html__(
67
-                    'JSON string of HTML attributes, such as class, to be applied to this form section\'s container.',
68
-                    'event_espresso'
69
-                ),
70
-                [$this, 'toJson']
71
-            ),
72
-            new GraphQLField(
73
-                'belongsTo',
74
-                'String',
75
-                'belongsTo',
76
-                esc_html__('UUID or ID of related entity this form section belongs to.', 'event_espresso')
77
-            ),
78
-            new GraphQLOutputField(
79
-                'isActive',
80
-                'Boolean',
81
-                'isActive',
82
-                esc_html__('Flag indicating whether the section is active.', 'event_espresso')
83
-            ),
84
-            new GraphQLOutputField(
85
-                'isArchived',
86
-                'Boolean',
87
-                'isArchived',
88
-                esc_html__('Flag indicating whether the section is archived.', 'event_espresso')
89
-            ),
90
-            new GraphQLOutputField(
91
-                'isDefault',
92
-                'Boolean',
93
-                'isDefault',
94
-                esc_html__('Flag indicating whether the section is a default one.', 'event_espresso')
95
-            ),
96
-            new GraphQLOutputField(
97
-                'isShared',
98
-                'Boolean',
99
-                'isShared',
100
-                esc_html__('Flag indicating whether the section is a shared one.', 'event_espresso')
101
-            ),
102
-            new GraphQLOutputField(
103
-                'isTrashed',
104
-                'Boolean',
105
-                'isTrashed',
106
-                esc_html__('Flag indicating whether the section is trashed.', 'event_espresso')
107
-            ),
108
-            new GraphQLField(
109
-                'label',
110
-                'String',
111
-                'label',
112
-                esc_html__(
113
-                    'JSON string of properties pertaining to a form section\'s label.',
114
-                    'event_espresso'
115
-                ),
116
-                [$this, 'toJson']
117
-            ),
118
-            new GraphQLField(
119
-                'order',
120
-                'Int',
121
-                'order',
122
-                esc_html__('Order in which form section appears in a form.', 'event_espresso')
123
-            ),
124
-            new GraphQLField(
125
-                'status',
126
-                $this->namespace . 'FormStatusEnum',
127
-                'status',
128
-                esc_html__(
129
-                    'Whether form section is active, archived, shared, trashed, or used as a default on new forms.',
130
-                    'event_espresso'
131
-                )
132
-            ),
133
-            new GraphQLOutputField(
134
-                'wpUser',
135
-                'User',
136
-                null,
137
-                esc_html__('WP User that created this form section.', 'event_espresso')
138
-            ),
139
-            new GraphQLInputField(
140
-                'wpUser',
141
-                'ID',
142
-                null,
143
-                esc_html__('ID of the WP User that created the form section.', 'event_espresso')
144
-            ),
145
-        ];
44
+	/**
45
+	 * @return GraphQLFieldInterface[]
46
+	 */
47
+	public function getFields(): array
48
+	{
49
+		$fields = [
50
+			new GraphQLField(
51
+				'id',
52
+				['non_null' => 'ID'],
53
+				null,
54
+				esc_html__('The globally unique ID for the object.', 'event_espresso')
55
+			),
56
+			new GraphQLField(
57
+				'appliesTo',
58
+				$this->namespace . 'FormSectionAppliesToEnum',
59
+				'appliesTo',
60
+				esc_html__('Form user type that this form section should be presented to.', 'event_espresso')
61
+			),
62
+			new GraphQLField(
63
+				'attributes',
64
+				'String',
65
+				'attributes',
66
+				esc_html__(
67
+					'JSON string of HTML attributes, such as class, to be applied to this form section\'s container.',
68
+					'event_espresso'
69
+				),
70
+				[$this, 'toJson']
71
+			),
72
+			new GraphQLField(
73
+				'belongsTo',
74
+				'String',
75
+				'belongsTo',
76
+				esc_html__('UUID or ID of related entity this form section belongs to.', 'event_espresso')
77
+			),
78
+			new GraphQLOutputField(
79
+				'isActive',
80
+				'Boolean',
81
+				'isActive',
82
+				esc_html__('Flag indicating whether the section is active.', 'event_espresso')
83
+			),
84
+			new GraphQLOutputField(
85
+				'isArchived',
86
+				'Boolean',
87
+				'isArchived',
88
+				esc_html__('Flag indicating whether the section is archived.', 'event_espresso')
89
+			),
90
+			new GraphQLOutputField(
91
+				'isDefault',
92
+				'Boolean',
93
+				'isDefault',
94
+				esc_html__('Flag indicating whether the section is a default one.', 'event_espresso')
95
+			),
96
+			new GraphQLOutputField(
97
+				'isShared',
98
+				'Boolean',
99
+				'isShared',
100
+				esc_html__('Flag indicating whether the section is a shared one.', 'event_espresso')
101
+			),
102
+			new GraphQLOutputField(
103
+				'isTrashed',
104
+				'Boolean',
105
+				'isTrashed',
106
+				esc_html__('Flag indicating whether the section is trashed.', 'event_espresso')
107
+			),
108
+			new GraphQLField(
109
+				'label',
110
+				'String',
111
+				'label',
112
+				esc_html__(
113
+					'JSON string of properties pertaining to a form section\'s label.',
114
+					'event_espresso'
115
+				),
116
+				[$this, 'toJson']
117
+			),
118
+			new GraphQLField(
119
+				'order',
120
+				'Int',
121
+				'order',
122
+				esc_html__('Order in which form section appears in a form.', 'event_espresso')
123
+			),
124
+			new GraphQLField(
125
+				'status',
126
+				$this->namespace . 'FormStatusEnum',
127
+				'status',
128
+				esc_html__(
129
+					'Whether form section is active, archived, shared, trashed, or used as a default on new forms.',
130
+					'event_espresso'
131
+				)
132
+			),
133
+			new GraphQLOutputField(
134
+				'wpUser',
135
+				'User',
136
+				null,
137
+				esc_html__('WP User that created this form section.', 'event_espresso')
138
+			),
139
+			new GraphQLInputField(
140
+				'wpUser',
141
+				'ID',
142
+				null,
143
+				esc_html__('ID of the WP User that created the form section.', 'event_espresso')
144
+			),
145
+		];
146 146
 
147
-        return apply_filters(
148
-            'FHEE__EventEspresso_core_domain_services_graphql_types__form_section_fields',
149
-            $fields,
150
-            $this->name,
151
-            $this->model
152
-        );
153
-    }
147
+		return apply_filters(
148
+			'FHEE__EventEspresso_core_domain_services_graphql_types__form_section_fields',
149
+			$fields,
150
+			$this->name,
151
+			$this->model
152
+		);
153
+	}
154 154
 
155 155
 
156
-    /**
157
-     * @param array $inputFields The mutation input fields.
158
-     * @throws InvalidArgumentException
159
-     * @throws ReflectionException
160
-     * @throws Exception
161
-     * @since 5.0.0.p
162
-     */
163
-    public function registerMutations(array $inputFields)
164
-    {
165
-        // Register mutation to update an entity.
166
-        register_graphql_mutation(
167
-            'update' . $this->name(),
168
-            [
169
-                'inputFields'         => $inputFields,
170
-                'outputFields'        => [
171
-                    lcfirst($this->name()) => [
172
-                        'type'    => $this->name(),
173
-                        'resolve' => [$this, 'resolveFromPayload'],
174
-                    ],
175
-                ],
176
-                'mutateAndGetPayload' => FormSectionUpdate::mutateAndGetPayload($this->model),
177
-            ]
178
-        );
179
-        // Register mutation to delete an entity.
180
-        register_graphql_mutation(
181
-            'delete' . $this->name(),
182
-            [
183
-                'inputFields'         => [
184
-                    'id' => $inputFields['id'],
185
-                ],
186
-                'outputFields'        => [
187
-                    lcfirst($this->name()) => [
188
-                        'type'        => $this->name(),
189
-                        'description' => esc_html__('The object before it was deleted', 'event_espresso'),
190
-                        'resolve'     => static function ($payload) {
191
-                            $deleted = (object) $payload['deleted'];
156
+	/**
157
+	 * @param array $inputFields The mutation input fields.
158
+	 * @throws InvalidArgumentException
159
+	 * @throws ReflectionException
160
+	 * @throws Exception
161
+	 * @since 5.0.0.p
162
+	 */
163
+	public function registerMutations(array $inputFields)
164
+	{
165
+		// Register mutation to update an entity.
166
+		register_graphql_mutation(
167
+			'update' . $this->name(),
168
+			[
169
+				'inputFields'         => $inputFields,
170
+				'outputFields'        => [
171
+					lcfirst($this->name()) => [
172
+						'type'    => $this->name(),
173
+						'resolve' => [$this, 'resolveFromPayload'],
174
+					],
175
+				],
176
+				'mutateAndGetPayload' => FormSectionUpdate::mutateAndGetPayload($this->model),
177
+			]
178
+		);
179
+		// Register mutation to delete an entity.
180
+		register_graphql_mutation(
181
+			'delete' . $this->name(),
182
+			[
183
+				'inputFields'         => [
184
+					'id' => $inputFields['id'],
185
+				],
186
+				'outputFields'        => [
187
+					lcfirst($this->name()) => [
188
+						'type'        => $this->name(),
189
+						'description' => esc_html__('The object before it was deleted', 'event_espresso'),
190
+						'resolve'     => static function ($payload) {
191
+							$deleted = (object) $payload['deleted'];
192 192
 
193
-                            return ! empty($deleted) ? $deleted : null;
194
-                        },
195
-                    ],
196
-                ],
197
-                'mutateAndGetPayload' => FormSectionDelete::mutateAndGetPayload($this->model),
198
-            ]
199
-        );
193
+							return ! empty($deleted) ? $deleted : null;
194
+						},
195
+					],
196
+				],
197
+				'mutateAndGetPayload' => FormSectionDelete::mutateAndGetPayload($this->model),
198
+			]
199
+		);
200 200
 
201
-        // Register mutation to update an entity.
202
-        register_graphql_mutation(
203
-            'create' . $this->name(),
204
-            [
205
-                'inputFields'         => $inputFields,
206
-                'outputFields'        => [
207
-                    lcfirst($this->name()) => [
208
-                        'type'    => $this->name(),
209
-                        'resolve' => [$this, 'resolveFromPayload'],
210
-                    ],
211
-                ],
212
-                'mutateAndGetPayload' => FormSectionCreate::mutateAndGetPayload($this->model),
213
-            ]
214
-        );
215
-    }
201
+		// Register mutation to update an entity.
202
+		register_graphql_mutation(
203
+			'create' . $this->name(),
204
+			[
205
+				'inputFields'         => $inputFields,
206
+				'outputFields'        => [
207
+					lcfirst($this->name()) => [
208
+						'type'    => $this->name(),
209
+						'resolve' => [$this, 'resolveFromPayload'],
210
+					],
211
+				],
212
+				'mutateAndGetPayload' => FormSectionCreate::mutateAndGetPayload($this->model),
213
+			]
214
+		);
215
+	}
216 216
 }
Please login to merge, or discard this patch.
core/domain/services/graphql/mutators/FormSectionDelete.php 2 patches
Indentation   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -17,73 +17,73 @@
 block discarded – undo
17 17
 class FormSectionDelete extends EntityMutator
18 18
 {
19 19
 
20
-    /**
21
-     * Defines the mutation data modification closure.
22
-     *
23
-     * @param EEM_Form_Section $model
24
-     * @return callable
25
-     */
26
-    public static function mutateAndGetPayload(EEM_Form_Section $model)
27
-    {
28
-        /**
29
-         * Deletes an entity.
30
-         *
31
-         * @param array       $input   The input for the mutation
32
-         * @param AppContext  $context The AppContext passed down to all resolvers
33
-         * @param ResolveInfo $info    The ResolveInfo passed down to all resolvers
34
-         * @return array
35
-         */
36
-        return static function (array $input, AppContext $context, ResolveInfo $info) use ($model): array {
37
-            try {
38
-                /** @var EE_Form_Section $entity */
39
-                $entity = EntityMutator::getEntityFromInputData($model, $input);
20
+	/**
21
+	 * Defines the mutation data modification closure.
22
+	 *
23
+	 * @param EEM_Form_Section $model
24
+	 * @return callable
25
+	 */
26
+	public static function mutateAndGetPayload(EEM_Form_Section $model)
27
+	{
28
+		/**
29
+		 * Deletes an entity.
30
+		 *
31
+		 * @param array       $input   The input for the mutation
32
+		 * @param AppContext  $context The AppContext passed down to all resolvers
33
+		 * @param ResolveInfo $info    The ResolveInfo passed down to all resolvers
34
+		 * @return array
35
+		 */
36
+		return static function (array $input, AppContext $context, ResolveInfo $info) use ($model): array {
37
+			try {
38
+				/** @var EE_Form_Section $entity */
39
+				$entity = EntityMutator::getEntityFromInputData($model, $input);
40 40
 
41
-                $result = FormSectionDelete::deleteSectionAndRelations($entity);
41
+				$result = FormSectionDelete::deleteSectionAndRelations($entity);
42 42
 
43
-                EntityMutator::validateResults($result);
43
+				EntityMutator::validateResults($result);
44 44
 
45
-                do_action(
46
-                    'AHEE__EventEspresso_core_domain_services_graphql_mutators_form_section_delete',
47
-                    $entity,
48
-                    $input
49
-                );
50
-            } catch (Exception $exception) {
51
-                EntityMutator::handleExceptions(
52
-                    $exception,
53
-                    esc_html__(
54
-                        'The form section could not be deleted because of the following error(s)',
55
-                        'event_espresso'
56
-                    )
57
-                );
58
-            }
45
+				do_action(
46
+					'AHEE__EventEspresso_core_domain_services_graphql_mutators_form_section_delete',
47
+					$entity,
48
+					$input
49
+				);
50
+			} catch (Exception $exception) {
51
+				EntityMutator::handleExceptions(
52
+					$exception,
53
+					esc_html__(
54
+						'The form section could not be deleted because of the following error(s)',
55
+						'event_espresso'
56
+					)
57
+				);
58
+			}
59 59
 
60
-            return [
61
-                'deleted' => $entity,
62
-            ];
63
-        };
64
-    }
60
+			return [
61
+				'deleted' => $entity,
62
+			];
63
+		};
64
+	}
65 65
 
66
-    /**
67
-     * Deletes a form section along with its related form elements.
68
-     *
69
-     * @param EE_Form_Section $entity
70
-     * @return bool | int
71
-     * @throws ReflectionException
72
-     * @throws InvalidArgumentException
73
-     * @throws InvalidInterfaceException
74
-     * @throws InvalidDataTypeException
75
-     * @throws EE_Error
76
-     */
77
-    public static function deleteSectionAndRelations(EE_Form_Section $entity)
78
-    {
79
-        // Remove related non-default form elements
80
-        $entity->delete_related('Form_Element', [
81
-            [
82
-                'FIN_status' => ['NOT IN', [ FormStatus::SHARED, FormStatus::DEFAULT] ]
83
-            ]
84
-        ]);
66
+	/**
67
+	 * Deletes a form section along with its related form elements.
68
+	 *
69
+	 * @param EE_Form_Section $entity
70
+	 * @return bool | int
71
+	 * @throws ReflectionException
72
+	 * @throws InvalidArgumentException
73
+	 * @throws InvalidInterfaceException
74
+	 * @throws InvalidDataTypeException
75
+	 * @throws EE_Error
76
+	 */
77
+	public static function deleteSectionAndRelations(EE_Form_Section $entity)
78
+	{
79
+		// Remove related non-default form elements
80
+		$entity->delete_related('Form_Element', [
81
+			[
82
+				'FIN_status' => ['NOT IN', [ FormStatus::SHARED, FormStatus::DEFAULT] ]
83
+			]
84
+		]);
85 85
 
86
-        // Now delete the form section
87
-        return $entity->delete();
88
-    }
86
+		// Now delete the form section
87
+		return $entity->delete();
88
+	}
89 89
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
          * @param ResolveInfo $info    The ResolveInfo passed down to all resolvers
34 34
          * @return array
35 35
          */
36
-        return static function (array $input, AppContext $context, ResolveInfo $info) use ($model): array {
36
+        return static function(array $input, AppContext $context, ResolveInfo $info) use ($model): array {
37 37
             try {
38 38
                 /** @var EE_Form_Section $entity */
39 39
                 $entity = EntityMutator::getEntityFromInputData($model, $input);
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
         // Remove related non-default form elements
80 80
         $entity->delete_related('Form_Element', [
81 81
             [
82
-                'FIN_status' => ['NOT IN', [ FormStatus::SHARED, FormStatus::DEFAULT] ]
82
+                'FIN_status' => ['NOT IN', [FormStatus::SHARED, FormStatus::DEFAULT]]
83 83
             ]
84 84
         ]);
85 85
 
Please login to merge, or discard this patch.
core/services/form/meta/inputs/Block.php 1 patch
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -4,36 +4,36 @@
 block discarded – undo
4 4
 
5 5
 class Block
6 6
 {
7
-    /**
8
-     * indicates that the element is a general HTML block
9
-     */
10
-    public const TYPE_HTML = 'html';
7
+	/**
8
+	 * indicates that the element is a general HTML block
9
+	 */
10
+	public const TYPE_HTML = 'html';
11 11
 
12
-    /**
13
-     * @var array
14
-     */
15
-    private $valid_type_options;
12
+	/**
13
+	 * @var array
14
+	 */
15
+	private $valid_type_options;
16 16
 
17 17
 
18
-    public function __construct()
19
-    {
20
-        $this->valid_type_options = apply_filters(
21
-            'FHEE__EventEspresso_core_services_form_meta_inputs_Block__valid_type_options',
22
-            [
23
-                Block::TYPE_HTML => esc_html__('HTML Block', 'event_espresso'),
24
-            ]
25
-        );
26
-    }
18
+	public function __construct()
19
+	{
20
+		$this->valid_type_options = apply_filters(
21
+			'FHEE__EventEspresso_core_services_form_meta_inputs_Block__valid_type_options',
22
+			[
23
+				Block::TYPE_HTML => esc_html__('HTML Block', 'event_espresso'),
24
+			]
25
+		);
26
+	}
27 27
 
28 28
 
29
-    /**
30
-     * @param bool $constants_only
31
-     * @return array
32
-     */
33
-    public function validTypeOptions(bool $constants_only = false): array
34
-    {
35
-        return $constants_only
36
-            ? array_keys($this->valid_type_options)
37
-            : $this->valid_type_options;
38
-    }
29
+	/**
30
+	 * @param bool $constants_only
31
+	 * @return array
32
+	 */
33
+	public function validTypeOptions(bool $constants_only = false): array
34
+	{
35
+		return $constants_only
36
+			? array_keys($this->valid_type_options)
37
+			: $this->valid_type_options;
38
+	}
39 39
 }
Please login to merge, or discard this patch.
core/db_models/helpers/EE_Table_Base.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
      */
94 94
     public function get_table_name()
95 95
     {
96
-        return $this->get_table_prefix() . $this->_table_name;
96
+        return $this->get_table_prefix().$this->_table_name;
97 97
     }
98 98
 
99 99
 
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
      */
106 106
     public function get_table_alias()
107 107
     {
108
-        if (! $this->_table_alias) {
108
+        if ( ! $this->_table_alias) {
109 109
             throw new EE_Error("You must call _construct_finalize_with_alias before using the EE_Table_Base. Did you forget to call parent::__construct at the end of your EEMerimental_Base child's __construct?");
110 110
         }
111 111
         return $this->_table_alias;
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
      */
129 129
     public function get_fully_qualified_pk_column()
130 130
     {
131
-        return $this->get_table_alias() . "." . $this->get_pk_column();
131
+        return $this->get_table_alias().".".$this->get_pk_column();
132 132
     }
133 133
 
134 134
 
@@ -139,8 +139,8 @@  discard block
 block discarded – undo
139 139
      */
140 140
     public function get_select_join_limit($limit)
141 141
     {
142
-        $limit = is_array($limit) ? 'LIMIT ' . implode(',', array_map('intval', $limit)) : 'LIMIT ' . (int) $limit;
143
-        return SP . '(SELECT * FROM ' . $this->_table_name . SP . $limit . ') AS ' . $this->_table_alias;
142
+        $limit = is_array($limit) ? 'LIMIT '.implode(',', array_map('intval', $limit)) : 'LIMIT '.(int) $limit;
143
+        return SP.'(SELECT * FROM '.$this->_table_name.SP.$limit.') AS '.$this->_table_alias;
144 144
     }
145 145
 
146 146
 
Please login to merge, or discard this patch.
Indentation   +147 added lines, -147 removed lines patch added patch discarded remove patch
@@ -6,151 +6,151 @@
 block discarded – undo
6 6
  */
7 7
 abstract class EE_Table_Base
8 8
 {
9
-    /**
10
-     * This holds the table_name without the table prefix.
11
-     *
12
-     * @var string
13
-     */
14
-    public string $_table_name;
15
-
16
-
17
-    /**
18
-     * This holds what is used as the alias for the table in queries.
19
-     *
20
-     * @var string
21
-     */
22
-    public string $_table_alias;
23
-
24
-
25
-    /**
26
-     * Table's private key column
27
-     *
28
-     * @var string|null
29
-     */
30
-    protected ?string $_pk_column = null;
31
-
32
-
33
-    /**
34
-     * Whether this table is a global table (in multisite) or specific to site.
35
-     *
36
-     * @var bool|null
37
-     */
38
-    protected ?bool $_global;
39
-
40
-
41
-    /**
42
-     * @param string      $table_name with or without wpdb prefix
43
-     * @param string|null $pk_column
44
-     * @param boolean     $global     whether the table is "global" as in there is only 1 table on an entire multisite
45
-     *                                install, or whether each site on a multisite installation has a copy of this table
46
-     * @global wpdb       $wpdb
47
-     */
48
-    public function __construct(string $table_name, ?string $pk_column, bool $global = false)
49
-    {
50
-        $this->_global = $global;
51
-        $prefix        = $this->get_table_prefix();
52
-        // if they added the prefix, let's remove it because we delay adding the prefix until right when it's needed.
53
-        if (strpos($table_name, $prefix) === 0) {
54
-            $table_name = substr_replace($table_name, '', 0, strlen($prefix));
55
-        }
56
-        $this->_table_name = $table_name;
57
-        $this->_pk_column  = $pk_column;
58
-    }
59
-
60
-
61
-    /**
62
-     * This returns the table prefix for the current model state.
63
-     *
64
-     * @return string
65
-     * @global wpdb $wpdb
66
-     */
67
-    public function get_table_prefix()
68
-    {
69
-        global $wpdb;
70
-        if ($this->_global) {
71
-            return $wpdb->base_prefix;
72
-        }
73
-        return $wpdb->get_blog_prefix(EEM_Base::get_model_query_blog_id());
74
-    }
75
-
76
-
77
-    /**
78
-     * Used to set the table_alias property
79
-     *
80
-     * @param string $table_alias
81
-     */
82
-    public function _construct_finalize_with_alias(string $table_alias)
83
-    {
84
-        $this->_table_alias = $table_alias;
85
-    }
86
-
87
-
88
-    /**
89
-     * Returns the fully qualified table name for the database (includes the table prefix current for the blog).
90
-     *
91
-     * @return string
92
-     */
93
-    public function get_table_name()
94
-    {
95
-        return $this->get_table_prefix() . $this->_table_name;
96
-    }
97
-
98
-
99
-    /**
100
-     * Provides what is currently set as the alias for the table to be used in queries.
101
-     *
102
-     * @return string
103
-     * @throws EE_Error
104
-     */
105
-    public function get_table_alias()
106
-    {
107
-        if (! $this->_table_alias) {
108
-            throw new EE_Error("You must call _construct_finalize_with_alias before using the EE_Table_Base. Did you forget to call parent::__construct at the end of your EEMerimental_Base child's __construct?");
109
-        }
110
-        return $this->_table_alias;
111
-    }
112
-
113
-
114
-    /**
115
-     * @return string name of column of PK
116
-     */
117
-    public function get_pk_column()
118
-    {
119
-        return $this->_pk_column;
120
-    }
121
-
122
-
123
-    /**
124
-     * returns a string with the table alias, a period, and the private key's column.
125
-     *
126
-     * @return string
127
-     */
128
-    public function get_fully_qualified_pk_column()
129
-    {
130
-        return $this->get_table_alias() . "." . $this->get_pk_column();
131
-    }
132
-
133
-
134
-    /**
135
-     * returns the special sql for a inner select with a limit.
136
-     *
137
-     * @return string    SQL select
138
-     */
139
-    public function get_select_join_limit($limit)
140
-    {
141
-        $limit = is_array($limit) ? 'LIMIT ' . implode(',', array_map('intval', $limit)) : 'LIMIT ' . (int) $limit;
142
-        return SP . '(SELECT * FROM ' . $this->_table_name . SP . $limit . ') AS ' . $this->_table_alias;
143
-    }
144
-
145
-
146
-    /**
147
-     * Returns whether or not htis is a global table (ie, on multisite there's
148
-     * only one of these tables, on the main blog)
149
-     *
150
-     * @return boolean
151
-     */
152
-    public function is_global()
153
-    {
154
-        return $this->_global;
155
-    }
9
+	/**
10
+	 * This holds the table_name without the table prefix.
11
+	 *
12
+	 * @var string
13
+	 */
14
+	public string $_table_name;
15
+
16
+
17
+	/**
18
+	 * This holds what is used as the alias for the table in queries.
19
+	 *
20
+	 * @var string
21
+	 */
22
+	public string $_table_alias;
23
+
24
+
25
+	/**
26
+	 * Table's private key column
27
+	 *
28
+	 * @var string|null
29
+	 */
30
+	protected ?string $_pk_column = null;
31
+
32
+
33
+	/**
34
+	 * Whether this table is a global table (in multisite) or specific to site.
35
+	 *
36
+	 * @var bool|null
37
+	 */
38
+	protected ?bool $_global;
39
+
40
+
41
+	/**
42
+	 * @param string      $table_name with or without wpdb prefix
43
+	 * @param string|null $pk_column
44
+	 * @param boolean     $global     whether the table is "global" as in there is only 1 table on an entire multisite
45
+	 *                                install, or whether each site on a multisite installation has a copy of this table
46
+	 * @global wpdb       $wpdb
47
+	 */
48
+	public function __construct(string $table_name, ?string $pk_column, bool $global = false)
49
+	{
50
+		$this->_global = $global;
51
+		$prefix        = $this->get_table_prefix();
52
+		// if they added the prefix, let's remove it because we delay adding the prefix until right when it's needed.
53
+		if (strpos($table_name, $prefix) === 0) {
54
+			$table_name = substr_replace($table_name, '', 0, strlen($prefix));
55
+		}
56
+		$this->_table_name = $table_name;
57
+		$this->_pk_column  = $pk_column;
58
+	}
59
+
60
+
61
+	/**
62
+	 * This returns the table prefix for the current model state.
63
+	 *
64
+	 * @return string
65
+	 * @global wpdb $wpdb
66
+	 */
67
+	public function get_table_prefix()
68
+	{
69
+		global $wpdb;
70
+		if ($this->_global) {
71
+			return $wpdb->base_prefix;
72
+		}
73
+		return $wpdb->get_blog_prefix(EEM_Base::get_model_query_blog_id());
74
+	}
75
+
76
+
77
+	/**
78
+	 * Used to set the table_alias property
79
+	 *
80
+	 * @param string $table_alias
81
+	 */
82
+	public function _construct_finalize_with_alias(string $table_alias)
83
+	{
84
+		$this->_table_alias = $table_alias;
85
+	}
86
+
87
+
88
+	/**
89
+	 * Returns the fully qualified table name for the database (includes the table prefix current for the blog).
90
+	 *
91
+	 * @return string
92
+	 */
93
+	public function get_table_name()
94
+	{
95
+		return $this->get_table_prefix() . $this->_table_name;
96
+	}
97
+
98
+
99
+	/**
100
+	 * Provides what is currently set as the alias for the table to be used in queries.
101
+	 *
102
+	 * @return string
103
+	 * @throws EE_Error
104
+	 */
105
+	public function get_table_alias()
106
+	{
107
+		if (! $this->_table_alias) {
108
+			throw new EE_Error("You must call _construct_finalize_with_alias before using the EE_Table_Base. Did you forget to call parent::__construct at the end of your EEMerimental_Base child's __construct?");
109
+		}
110
+		return $this->_table_alias;
111
+	}
112
+
113
+
114
+	/**
115
+	 * @return string name of column of PK
116
+	 */
117
+	public function get_pk_column()
118
+	{
119
+		return $this->_pk_column;
120
+	}
121
+
122
+
123
+	/**
124
+	 * returns a string with the table alias, a period, and the private key's column.
125
+	 *
126
+	 * @return string
127
+	 */
128
+	public function get_fully_qualified_pk_column()
129
+	{
130
+		return $this->get_table_alias() . "." . $this->get_pk_column();
131
+	}
132
+
133
+
134
+	/**
135
+	 * returns the special sql for a inner select with a limit.
136
+	 *
137
+	 * @return string    SQL select
138
+	 */
139
+	public function get_select_join_limit($limit)
140
+	{
141
+		$limit = is_array($limit) ? 'LIMIT ' . implode(',', array_map('intval', $limit)) : 'LIMIT ' . (int) $limit;
142
+		return SP . '(SELECT * FROM ' . $this->_table_name . SP . $limit . ') AS ' . $this->_table_alias;
143
+	}
144
+
145
+
146
+	/**
147
+	 * Returns whether or not htis is a global table (ie, on multisite there's
148
+	 * only one of these tables, on the main blog)
149
+	 *
150
+	 * @return boolean
151
+	 */
152
+	public function is_global()
153
+	{
154
+		return $this->_global;
155
+	}
156 156
 }
Please login to merge, or discard this patch.
core/services/form/meta/InputOptions.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
             $value = sanitize_key($option['value']);
94 94
 
95 95
             // use `value` as key
96
-            $this->options[ $value ] = compact('label', 'value');
96
+            $this->options[$value] = compact('label', 'value');
97 97
         }
98 98
     }
99 99
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
     public function removeOption(string $option_value): void
105 105
     {
106 106
         $option_value = sanitize_key($option_value);
107
-        unset($this->options[ $option_value ]);
107
+        unset($this->options[$option_value]);
108 108
     }
109 109
 
110 110
 
Please login to merge, or discard this patch.
Indentation   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -14,106 +14,106 @@
 block discarded – undo
14 14
  */
15 15
 class InputOptions implements JsonableInterface
16 16
 {
17
-    /**
18
-     * @var JsonDataHandler
19
-     */
20
-    private $json_data_handler;
21
-
22
-    /**
23
-     * Options for ENUM type inputs like checkboxes, radio buttons, select inputs, etc
24
-     *
25
-     * @var array
26
-     */
27
-    private $options = [];
28
-
29
-
30
-    /**
31
-     * HelpText constructor.
32
-     *
33
-     * @param JsonDataHandler $json_data_handler
34
-     * @param array           $options
35
-     */
36
-    public function __construct(JsonDataHandler $json_data_handler, array $options)
37
-    {
38
-        $this->json_data_handler = $json_data_handler;
39
-        $this->setOptions($options);
40
-    }
41
-
42
-
43
-    /**
44
-     * @param string $json
45
-     * @return InputOptions
46
-     */
47
-    public static function fromJson(string $json): InputOptions
48
-    {
49
-        $json_data_handler = new JsonDataHandler();
50
-        $json_data_handler->configure(JsonDataHandler::DATA_TYPE_ARRAY);
51
-        $data = $json_data_handler->decodeJson($json);
52
-        return new InputOptions($json_data_handler, (array) $data ?? []);
53
-    }
54
-
55
-
56
-    /**
57
-     * @return array
58
-     */
59
-    public function toArray(): array
60
-    {
61
-        return array_values($this->options);
62
-    }
63
-
64
-
65
-    /**
66
-     * @return string
67
-     */
68
-    public function toJson(): string
69
-    {
70
-        return $this->json_data_handler->encodeData($this->toArray());
71
-    }
72
-
73
-
74
-    /**
75
-     * an array where keys are option values and values are option labels
76
-     *
77
-     * @return array
78
-     */
79
-    public function options(): array
80
-    {
81
-        return $this->options;
82
-    }
83
-
84
-
85
-    /**
86
-     * @param array $option
87
-     */
88
-    public function addOption(array $option): void
89
-    {
90
-        if (isset($option['label'], $option['value'])) {
91
-            $label = sanitize_text_field($option['label']);
92
-            $value = sanitize_key($option['value']);
93
-
94
-            // use `value` as key
95
-            $this->options[ $value ] = compact('label', 'value');
96
-        }
97
-    }
98
-
99
-
100
-    /**
101
-     * @param int|float|string $option_value
102
-     */
103
-    public function removeOption(string $option_value): void
104
-    {
105
-        $option_value = sanitize_key($option_value);
106
-        unset($this->options[ $option_value ]);
107
-    }
108
-
109
-
110
-    /**
111
-     * @param array $options an array where keys are option values and values are option labels
112
-     */
113
-    public function setOptions(array $options): void
114
-    {
115
-        foreach ($options as $option) {
116
-            $this->addOption((array) $option);
117
-        }
118
-    }
17
+	/**
18
+	 * @var JsonDataHandler
19
+	 */
20
+	private $json_data_handler;
21
+
22
+	/**
23
+	 * Options for ENUM type inputs like checkboxes, radio buttons, select inputs, etc
24
+	 *
25
+	 * @var array
26
+	 */
27
+	private $options = [];
28
+
29
+
30
+	/**
31
+	 * HelpText constructor.
32
+	 *
33
+	 * @param JsonDataHandler $json_data_handler
34
+	 * @param array           $options
35
+	 */
36
+	public function __construct(JsonDataHandler $json_data_handler, array $options)
37
+	{
38
+		$this->json_data_handler = $json_data_handler;
39
+		$this->setOptions($options);
40
+	}
41
+
42
+
43
+	/**
44
+	 * @param string $json
45
+	 * @return InputOptions
46
+	 */
47
+	public static function fromJson(string $json): InputOptions
48
+	{
49
+		$json_data_handler = new JsonDataHandler();
50
+		$json_data_handler->configure(JsonDataHandler::DATA_TYPE_ARRAY);
51
+		$data = $json_data_handler->decodeJson($json);
52
+		return new InputOptions($json_data_handler, (array) $data ?? []);
53
+	}
54
+
55
+
56
+	/**
57
+	 * @return array
58
+	 */
59
+	public function toArray(): array
60
+	{
61
+		return array_values($this->options);
62
+	}
63
+
64
+
65
+	/**
66
+	 * @return string
67
+	 */
68
+	public function toJson(): string
69
+	{
70
+		return $this->json_data_handler->encodeData($this->toArray());
71
+	}
72
+
73
+
74
+	/**
75
+	 * an array where keys are option values and values are option labels
76
+	 *
77
+	 * @return array
78
+	 */
79
+	public function options(): array
80
+	{
81
+		return $this->options;
82
+	}
83
+
84
+
85
+	/**
86
+	 * @param array $option
87
+	 */
88
+	public function addOption(array $option): void
89
+	{
90
+		if (isset($option['label'], $option['value'])) {
91
+			$label = sanitize_text_field($option['label']);
92
+			$value = sanitize_key($option['value']);
93
+
94
+			// use `value` as key
95
+			$this->options[ $value ] = compact('label', 'value');
96
+		}
97
+	}
98
+
99
+
100
+	/**
101
+	 * @param int|float|string $option_value
102
+	 */
103
+	public function removeOption(string $option_value): void
104
+	{
105
+		$option_value = sanitize_key($option_value);
106
+		unset($this->options[ $option_value ]);
107
+	}
108
+
109
+
110
+	/**
111
+	 * @param array $options an array where keys are option values and values are option labels
112
+	 */
113
+	public function setOptions(array $options): void
114
+	{
115
+		foreach ($options as $option) {
116
+			$this->addOption((array) $option);
117
+		}
118
+	}
119 119
 }
Please login to merge, or discard this patch.
core/db_models/fields/EE_JSON_Field.php 1 patch
Indentation   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -5,76 +5,76 @@
 block discarded – undo
5 5
 class EE_JSON_Field extends EE_Model_Field_Base
6 6
 {
7 7
 
8
-    /**
9
-     * @var JsonDataHandler
10
-     */
11
-    private $json_data_handler;
8
+	/**
9
+	 * @var JsonDataHandler
10
+	 */
11
+	private $json_data_handler;
12 12
 
13 13
 
14
-    /**
15
-     * @param string $table_column
16
-     * @param string $nicename
17
-     * @param bool   $nullable
18
-     * @param null   $default_value
19
-     */
20
-    public function __construct(
21
-        $table_column,
22
-        $nicename,
23
-        $nullable,
24
-        $default_value = null
25
-    ) {
26
-        $this->json_data_handler = new JsonDataHandler();
27
-        $this->json_data_handler->configure(
28
-            JsonDataHandler::DATA_TYPE_OBJECT
29
-        );
30
-        parent::__construct($table_column, $nicename, $nullable, $default_value);
31
-    }
14
+	/**
15
+	 * @param string $table_column
16
+	 * @param string $nicename
17
+	 * @param bool   $nullable
18
+	 * @param null   $default_value
19
+	 */
20
+	public function __construct(
21
+		$table_column,
22
+		$nicename,
23
+		$nullable,
24
+		$default_value = null
25
+	) {
26
+		$this->json_data_handler = new JsonDataHandler();
27
+		$this->json_data_handler->configure(
28
+			JsonDataHandler::DATA_TYPE_OBJECT
29
+		);
30
+		parent::__construct($table_column, $nicename, $nullable, $default_value);
31
+	}
32 32
 
33 33
 
34
-    // /**
35
-    //  * When get() is called on a model object (eg EE_Event), before returning its value,
36
-    //  * call this function on it, allowing us to customize the returned value based on
37
-    //  * the field's type. Eg, we may want to unserialize it, strip tags, etc. By default,
38
-    //  * we simply return it.
39
-    //  *
40
-    //  * @param mixed $value_of_field_on_model_object
41
-    //  * @return mixed
42
-    //  */
43
-    // public function prepare_for_get($value_of_field_on_model_object)
44
-    // {
45
-    //     // return $this->json_data_handler->decodeJson($value_of_field_on_model_object);
46
-    //     return $value_of_field_on_model_object;
47
-    // }
34
+	// /**
35
+	//  * When get() is called on a model object (eg EE_Event), before returning its value,
36
+	//  * call this function on it, allowing us to customize the returned value based on
37
+	//  * the field's type. Eg, we may want to unserialize it, strip tags, etc. By default,
38
+	//  * we simply return it.
39
+	//  *
40
+	//  * @param mixed $value_of_field_on_model_object
41
+	//  * @return mixed
42
+	//  */
43
+	// public function prepare_for_get($value_of_field_on_model_object)
44
+	// {
45
+	//     // return $this->json_data_handler->decodeJson($value_of_field_on_model_object);
46
+	//     return $value_of_field_on_model_object;
47
+	// }
48 48
 
49 49
 
50
-    /**
51
-     * When creating a brand-new model object, or setting a particular value for one of its fields, this function
52
-     * is called before setting it on the model object. We may want to strip slashes, unserialize the value, etc.
53
-     * By default, we do nothing.
54
-     *
55
-     * If the model field is going to perform any validation on the input, this is where it should be done
56
-     * (once the value is on the model object, it may be used in other ways besides putting it into the DB
57
-     * so it's best to validate it right away).
58
-     *
59
-     * @param mixed $value_inputted_for_field_on_model_object
60
-     * @return string
61
-     */
62
-    public function prepare_for_set($value_inputted_for_field_on_model_object)
63
-    {
64
-        return $this->json_data_handler->encodeData($value_inputted_for_field_on_model_object);
65
-    }
50
+	/**
51
+	 * When creating a brand-new model object, or setting a particular value for one of its fields, this function
52
+	 * is called before setting it on the model object. We may want to strip slashes, unserialize the value, etc.
53
+	 * By default, we do nothing.
54
+	 *
55
+	 * If the model field is going to perform any validation on the input, this is where it should be done
56
+	 * (once the value is on the model object, it may be used in other ways besides putting it into the DB
57
+	 * so it's best to validate it right away).
58
+	 *
59
+	 * @param mixed $value_inputted_for_field_on_model_object
60
+	 * @return string
61
+	 */
62
+	public function prepare_for_set($value_inputted_for_field_on_model_object)
63
+	{
64
+		return $this->json_data_handler->encodeData($value_inputted_for_field_on_model_object);
65
+	}
66 66
 
67 67
 
68
-    /**
69
-     * When inserting or updating a field on a model object, run this function on each
70
-     * value to prepare it for insertion into the db. Generally this converts
71
-     * the validated input on the model object into the format used in the DB.
72
-     *
73
-     * @param mixed $value_of_field_on_model_object
74
-     * @return string
75
-     */
76
-    public function prepare_for_use_in_db($value_of_field_on_model_object)
77
-    {
78
-        return $this->json_data_handler->encodeData($value_of_field_on_model_object);
79
-    }
68
+	/**
69
+	 * When inserting or updating a field on a model object, run this function on each
70
+	 * value to prepare it for insertion into the db. Generally this converts
71
+	 * the validated input on the model object into the format used in the DB.
72
+	 *
73
+	 * @param mixed $value_of_field_on_model_object
74
+	 * @return string
75
+	 */
76
+	public function prepare_for_use_in_db($value_of_field_on_model_object)
77
+	{
78
+		return $this->json_data_handler->encodeData($value_of_field_on_model_object);
79
+	}
80 80
 }
Please login to merge, or discard this patch.
core/db_classes/EE_Form_Element.class.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
      */
138 138
     public function attributes(): ?Attributes
139 139
     {
140
-        if (! $this->attributes instanceof Attributes) {
140
+        if ( ! $this->attributes instanceof Attributes) {
141 141
             $this->attributes = Attributes::fromJson($this->get('FIN_attributes'));
142 142
         }
143 143
         return $this->attributes;
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
      */
192 192
     public function helpText(): ?HelpText
193 193
     {
194
-        if (! $this->helpText instanceof HelpText) {
194
+        if ( ! $this->helpText instanceof HelpText) {
195 195
             $this->helpText = HelpText::fromJson($this->get('FIN_helpText'));
196 196
         }
197 197
         return $this->helpText;
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
      */
222 222
     public function label(): ?FormLabel
223 223
     {
224
-        if (! $this->label instanceof FormLabel) {
224
+        if ( ! $this->label instanceof FormLabel) {
225 225
             $this->label = FormLabel::fromJson($this->get('FIN_label'));
226 226
         }
227 227
         return $this->label;
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
     public function setMapsTo(string $model, string $field)
265 265
     {
266 266
         $model_name = strpos($model, 'EEM_') !== 0 ? "EEM_$model" : $model;
267
-        if (! class_exists($model_name)) {
267
+        if ( ! class_exists($model_name)) {
268 268
             throw new DomainException(
269 269
                 sprintf(
270 270
                     esc_html__(
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
      */
289 289
     public function options(): ?InputOptions
290 290
     {
291
-        if (! $this->options instanceof InputOptions) {
291
+        if ( ! $this->options instanceof InputOptions) {
292 292
             $this->options = InputOptions::fromJson($this->get('FIN_options'));
293 293
         }
294 294
         return $this->options;
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
      */
368 368
     public function required(): ?Required
369 369
     {
370
-        if (! $this->required instanceof Required) {
370
+        if ( ! $this->required instanceof Required) {
371 371
             $this->required = Required::fromJson($this->get('FIN_required'));
372 372
         }
373 373
         return $this->required;
Please login to merge, or discard this patch.
Indentation   +467 added lines, -467 removed lines patch added patch discarded remove patch
@@ -28,471 +28,471 @@
 block discarded – undo
28 28
  */
29 29
 class EE_Form_Element extends EE_Base_Class
30 30
 {
31
-    /**
32
-     * @var Attributes
33
-     */
34
-    private $attributes;
35
-
36
-    /**
37
-     * @var FormLabel
38
-     */
39
-    private $label;
40
-
41
-    /**
42
-     * @var HelpText
43
-     */
44
-    private $helpText;
45
-
46
-    /**
47
-     * @var InputOptions
48
-     */
49
-    private $options;
50
-
51
-    /**
52
-     * @var Required
53
-     */
54
-    private $required;
55
-
56
-
57
-    /**
58
-     * @param array $props_n_values
59
-     * @return EE_Form_Element
60
-     * @throws EE_Error
61
-     * @throws ReflectionException
62
-     */
63
-    public static function new_instance(array $props_n_values = []): EE_Form_Element
64
-    {
65
-        $has_object = parent::_check_for_object($props_n_values, __CLASS__);
66
-        return $has_object ?: new self($props_n_values);
67
-    }
68
-
69
-
70
-    /**
71
-     * @param array $props_n_values
72
-     * @return EE_Form_Element
73
-     * @throws EE_Error
74
-     * @throws ReflectionException
75
-     */
76
-    public static function new_instance_from_db(array $props_n_values = []): EE_Form_Element
77
-    {
78
-        return new self($props_n_values);
79
-    }
80
-
81
-
82
-    /**
83
-     * Form Element UUID (universally unique identifier)
84
-     *
85
-     * @return string
86
-     * @throws EE_Error
87
-     * @throws ReflectionException
88
-     */
89
-    public function UUID(): string
90
-    {
91
-        return $this->get('FIN_UUID');
92
-    }
93
-
94
-
95
-    /**
96
-     * @param string $UUID
97
-     * @throws EE_Error
98
-     * @throws ReflectionException
99
-     */
100
-    public function setUUID(string $UUID)
101
-    {
102
-        $this->set('FIN_UUID', $UUID);
103
-    }
104
-
105
-
106
-    /**
107
-     * Whether or not input is only displayed in the admin. If false, input will appear in public forms
108
-     *
109
-     * @return bool
110
-     * @throws EE_Error
111
-     * @throws ReflectionException
112
-     */
113
-    public function adminOnly(): ?bool
114
-    {
115
-        return $this->get('FIN_adminOnly');
116
-    }
117
-
118
-
119
-    /**
120
-     * @param bool $admin_only
121
-     * @throws EE_Error
122
-     * @throws ReflectionException
123
-     */
124
-    public function setAdminOnly(bool $admin_only)
125
-    {
126
-        $this->set('FIN_adminOnly', $admin_only);
127
-    }
128
-
129
-
130
-    /**
131
-     * JSON string of HTML attributes such as class, max, min, placeholder, type, etc.
132
-     *
133
-     * @return Attributes
134
-     * @throws EE_Error
135
-     * @throws ReflectionException
136
-     */
137
-    public function attributes(): ?Attributes
138
-    {
139
-        if (! $this->attributes instanceof Attributes) {
140
-            $this->attributes = Attributes::fromJson($this->get('FIN_attributes'));
141
-        }
142
-        return $this->attributes;
143
-    }
144
-
145
-
146
-    /**
147
-     * @param Attributes $attributes
148
-     * @throws EE_Error
149
-     * @throws ReflectionException
150
-     */
151
-    public function setAttributes(Attributes $attributes)
152
-    {
153
-        // set local object
154
-        $this->attributes = $attributes;
155
-        // then pass to model as an array which will get converted to JSON by the model field
156
-        $this->set('FIN_attributes', $attributes->toArray());
157
-    }
158
-
159
-
160
-    /**
161
-     * UUID of parent form section this form input belongs to.
162
-     *
163
-     * @return string
164
-     * @throws EE_Error
165
-     * @throws ReflectionException
166
-     */
167
-    public function belongsTo(): string
168
-    {
169
-        return $this->get('FSC_UUID');
170
-    }
171
-
172
-
173
-    /**
174
-     * @param string $relation_UUID
175
-     * @throws EE_Error
176
-     * @throws ReflectionException
177
-     */
178
-    public function setBelongsTo(string $relation_UUID)
179
-    {
180
-        $this->set('FSC_UUID', $relation_UUID);
181
-    }
182
-
183
-
184
-    /**
185
-     * returns a HelpText object for managing input help text
186
-     *
187
-     * @return HelpText
188
-     * @throws EE_Error
189
-     * @throws ReflectionException
190
-     */
191
-    public function helpText(): ?HelpText
192
-    {
193
-        if (! $this->helpText instanceof HelpText) {
194
-            $this->helpText = HelpText::fromJson($this->get('FIN_helpText'));
195
-        }
196
-        return $this->helpText;
197
-    }
198
-
199
-
200
-    /**
201
-     * @param HelpText $helpText
202
-     * @throws EE_Error
203
-     * @throws ReflectionException
204
-     */
205
-    public function setHelpText(HelpText $helpText)
206
-    {
207
-        // set local object
208
-        $this->helpText = $helpText;
209
-        // then pass to model as an array which will get converted to JSON by the model field
210
-        $this->set('FIN_helpText', $helpText->toArray());
211
-    }
212
-
213
-
214
-    /**
215
-     * returns a FormLabel object for managing input labels
216
-     *
217
-     * @return FormLabel
218
-     * @throws EE_Error
219
-     * @throws ReflectionException
220
-     */
221
-    public function label(): ?FormLabel
222
-    {
223
-        if (! $this->label instanceof FormLabel) {
224
-            $this->label = FormLabel::fromJson($this->get('FIN_label'));
225
-        }
226
-        return $this->label;
227
-    }
228
-
229
-
230
-    /**
231
-     * @param FormLabel $label
232
-     * @throws EE_Error
233
-     * @throws ReflectionException
234
-     */
235
-    public function setLabel(FormLabel $label)
236
-    {
237
-        // set local object
238
-        $this->label = $label;
239
-        // then pass to model as an array which will get converted to JSON by the model field
240
-        $this->set('FIN_label', $label->toArray());
241
-    }
242
-
243
-
244
-    /**
245
-     * Model and Fields name that this input maps to; ex: Attendee.email
246
-     *
247
-     * @return string
248
-     * @throws EE_Error
249
-     * @throws ReflectionException
250
-     */
251
-    public function mapsTo(): ?string
252
-    {
253
-        return $this->get('FIN_mapsTo');
254
-    }
255
-
256
-
257
-    /**
258
-     * @param string $model ex: Attendee
259
-     * @param string $field ex: email
260
-     * @throws EE_Error
261
-     * @throws ReflectionException
262
-     */
263
-    public function setMapsTo(string $model, string $field)
264
-    {
265
-        $model_name = strpos($model, 'EEM_') !== 0 ? "EEM_$model" : $model;
266
-        if (! class_exists($model_name)) {
267
-            throw new DomainException(
268
-                sprintf(
269
-                    esc_html__(
270
-                        'The %1$s model does not exist or can not be located. Please verify the spelling and whether it is loaded.',
271
-                        'event_espresso'
272
-                    ),
273
-                    $model_name
274
-                )
275
-            );
276
-        }
277
-        $this->set('FIN_mapsTo', "{$model}.{$field}");
278
-    }
279
-
280
-
281
-    /**
282
-     * Options for ENUM type inputs like checkboxes, radio buttons, select inputs, etc
283
-     *
284
-     * @return InputOptions
285
-     * @throws EE_Error
286
-     * @throws ReflectionException
287
-     */
288
-    public function options(): ?InputOptions
289
-    {
290
-        if (! $this->options instanceof InputOptions) {
291
-            $this->options = InputOptions::fromJson($this->get('FIN_options'));
292
-        }
293
-        return $this->options;
294
-    }
295
-
296
-
297
-    /**
298
-     * @param InputOptions $options
299
-     * @throws EE_Error
300
-     * @throws ReflectionException
301
-     */
302
-    public function setOptions(InputOptions $options)
303
-    {
304
-        // set local object
305
-        $this->options = $options;
306
-        // then pass to model as an array which will get converted to JSON by the model field
307
-        $this->set('FIN_options', $options->toArray());
308
-    }
309
-
310
-
311
-
312
-    /**
313
-     * Order in which form input appears in a form.
314
-     *
315
-     * @return int
316
-     * @throws EE_Error
317
-     * @throws ReflectionException
318
-     */
319
-    public function order(): int
320
-    {
321
-        return $this->get('FIN_order');
322
-    }
323
-
324
-
325
-    /**
326
-     * @param int $order
327
-     * @throws EE_Error
328
-     * @throws ReflectionException
329
-     */
330
-    public function setOrder(int $order)
331
-    {
332
-        $this->set('FIN_order', $order);
333
-    }
334
-
335
-
336
-    /**
337
-     * Example text displayed within an input to assist users with completing the form.
338
-     *
339
-     * @return string
340
-     * @throws EE_Error
341
-     * @throws ReflectionException
342
-     */
343
-    public function placeholder(): ?string
344
-    {
345
-        return $this->get('FIN_placeholder');
346
-    }
347
-
348
-
349
-    /**
350
-     * @param string $placeholder
351
-     * @throws EE_Error
352
-     * @throws ReflectionException
353
-     */
354
-    public function setPlaceholder(string $placeholder)
355
-    {
356
-        $this->set('FIN_placeholder', $placeholder);
357
-    }
358
-
359
-
360
-    /**
361
-     * Whether or not the input must be supplied with a value in order to complete the form.
362
-     *
363
-     * @return Required
364
-     * @throws EE_Error
365
-     * @throws ReflectionException
366
-     */
367
-    public function required(): ?Required
368
-    {
369
-        if (! $this->required instanceof Required) {
370
-            $this->required = Required::fromJson($this->get('FIN_required'));
371
-        }
372
-        return $this->required;
373
-    }
374
-
375
-
376
-    /**
377
-     * @param Required $required
378
-     * @throws EE_Error
379
-     * @throws ReflectionException
380
-     */
381
-    public function setRequired(Required $required)
382
-    {
383
-        // set local object
384
-        $this->required = $required;
385
-        // then pass to model as an array which will get converted to JSON by the model field
386
-        $this->set('FIN_required', $required->toArray());
387
-    }
388
-
389
-
390
-    /**
391
-     * version of public label for use in identifiers
392
-     *
393
-     * @return string
394
-     * @throws EE_Error
395
-     * @throws ReflectionException
396
-     */
397
-    public function slug(): ?string
398
-    {
399
-        return sanitize_title($this->label()->publicLabel());
400
-    }
401
-
402
-
403
-    /**
404
-     * Whether form input is active, archived, trashed, or used as a default on new forms.
405
-     * Values correspond to the EEM_Form_Element::STATUS_* constants.
406
-     *
407
-     * @return string
408
-     * @throws EE_Error
409
-     * @throws ReflectionException
410
-     */
411
-    public function status(): string
412
-    {
413
-        return $this->get('FIN_status');
414
-    }
415
-
416
-
417
-    /**
418
-     * Whether form input is active, archived, trashed, or used as a default on new forms.
419
-     * Values correspond to the EEM_Form_Element::STATUS_* constants.
420
-     *
421
-     * @param string $status
422
-     * @throws EE_Error
423
-     * @throws ReflectionException
424
-     */
425
-    public function setStatus(string $status)
426
-    {
427
-        $this->set('FIN_status', $status);
428
-    }
429
-
430
-
431
-    /**
432
-     * Form input type.
433
-     * Values correspond to the EventEspresso\core\domain\entities\form\Input::TYPE_* constants.
434
-     *
435
-     * @return string
436
-     * @throws EE_Error
437
-     * @throws ReflectionException
438
-     */
439
-    public function type(): ?string
440
-    {
441
-        return $this->get('FIN_type');
442
-    }
443
-
444
-
445
-    /**
446
-     * @param string $type
447
-     * @throws EE_Error
448
-     * @throws ReflectionException
449
-     */
450
-    public function setType(string $type)
451
-    {
452
-        $this->set('FIN_type', $type);
453
-    }
454
-
455
-
456
-    /**
457
-     * ID of the WP User that created this form input.
458
-     *
459
-     * @return int
460
-     * @throws EE_Error
461
-     * @throws ReflectionException
462
-     */
463
-    public function wp_user(): int
464
-    {
465
-        return $this->get('FIN_wpUser');
466
-    }
467
-
468
-
469
-    /**
470
-     * returns the id the wordpress user who created this question
471
-     *
472
-     * @param int $wp_user
473
-     * @throws EE_Error
474
-     * @throws ReflectionException
475
-     */
476
-    public function setWpUser(int $wp_user)
477
-    {
478
-        $this->set('FIN_wpUser', $wp_user);
479
-    }
480
-
481
-
482
-    /**
483
-     * @param array $set_cols_n_values
484
-     * @return bool|int|string
485
-     * @throws EE_Error
486
-     * @throws ReflectionException
487
-     */
488
-    public function save($set_cols_n_values = [])
489
-    {
490
-        // make sure internal versions for all composite objects are updated
491
-        $this->set('FIN_attributes', $this->attributes()->toArray());
492
-        $this->set('FIN_helpText', $this->helpText()->toArray());
493
-        $this->set('FIN_label', $this->label()->toArray());
494
-        $this->set('FIN_options', $this->options()->toArray());
495
-        $this->set('FIN_required', $this->required()->toArray());
496
-        return parent::save($set_cols_n_values);
497
-    }
31
+	/**
32
+	 * @var Attributes
33
+	 */
34
+	private $attributes;
35
+
36
+	/**
37
+	 * @var FormLabel
38
+	 */
39
+	private $label;
40
+
41
+	/**
42
+	 * @var HelpText
43
+	 */
44
+	private $helpText;
45
+
46
+	/**
47
+	 * @var InputOptions
48
+	 */
49
+	private $options;
50
+
51
+	/**
52
+	 * @var Required
53
+	 */
54
+	private $required;
55
+
56
+
57
+	/**
58
+	 * @param array $props_n_values
59
+	 * @return EE_Form_Element
60
+	 * @throws EE_Error
61
+	 * @throws ReflectionException
62
+	 */
63
+	public static function new_instance(array $props_n_values = []): EE_Form_Element
64
+	{
65
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__);
66
+		return $has_object ?: new self($props_n_values);
67
+	}
68
+
69
+
70
+	/**
71
+	 * @param array $props_n_values
72
+	 * @return EE_Form_Element
73
+	 * @throws EE_Error
74
+	 * @throws ReflectionException
75
+	 */
76
+	public static function new_instance_from_db(array $props_n_values = []): EE_Form_Element
77
+	{
78
+		return new self($props_n_values);
79
+	}
80
+
81
+
82
+	/**
83
+	 * Form Element UUID (universally unique identifier)
84
+	 *
85
+	 * @return string
86
+	 * @throws EE_Error
87
+	 * @throws ReflectionException
88
+	 */
89
+	public function UUID(): string
90
+	{
91
+		return $this->get('FIN_UUID');
92
+	}
93
+
94
+
95
+	/**
96
+	 * @param string $UUID
97
+	 * @throws EE_Error
98
+	 * @throws ReflectionException
99
+	 */
100
+	public function setUUID(string $UUID)
101
+	{
102
+		$this->set('FIN_UUID', $UUID);
103
+	}
104
+
105
+
106
+	/**
107
+	 * Whether or not input is only displayed in the admin. If false, input will appear in public forms
108
+	 *
109
+	 * @return bool
110
+	 * @throws EE_Error
111
+	 * @throws ReflectionException
112
+	 */
113
+	public function adminOnly(): ?bool
114
+	{
115
+		return $this->get('FIN_adminOnly');
116
+	}
117
+
118
+
119
+	/**
120
+	 * @param bool $admin_only
121
+	 * @throws EE_Error
122
+	 * @throws ReflectionException
123
+	 */
124
+	public function setAdminOnly(bool $admin_only)
125
+	{
126
+		$this->set('FIN_adminOnly', $admin_only);
127
+	}
128
+
129
+
130
+	/**
131
+	 * JSON string of HTML attributes such as class, max, min, placeholder, type, etc.
132
+	 *
133
+	 * @return Attributes
134
+	 * @throws EE_Error
135
+	 * @throws ReflectionException
136
+	 */
137
+	public function attributes(): ?Attributes
138
+	{
139
+		if (! $this->attributes instanceof Attributes) {
140
+			$this->attributes = Attributes::fromJson($this->get('FIN_attributes'));
141
+		}
142
+		return $this->attributes;
143
+	}
144
+
145
+
146
+	/**
147
+	 * @param Attributes $attributes
148
+	 * @throws EE_Error
149
+	 * @throws ReflectionException
150
+	 */
151
+	public function setAttributes(Attributes $attributes)
152
+	{
153
+		// set local object
154
+		$this->attributes = $attributes;
155
+		// then pass to model as an array which will get converted to JSON by the model field
156
+		$this->set('FIN_attributes', $attributes->toArray());
157
+	}
158
+
159
+
160
+	/**
161
+	 * UUID of parent form section this form input belongs to.
162
+	 *
163
+	 * @return string
164
+	 * @throws EE_Error
165
+	 * @throws ReflectionException
166
+	 */
167
+	public function belongsTo(): string
168
+	{
169
+		return $this->get('FSC_UUID');
170
+	}
171
+
172
+
173
+	/**
174
+	 * @param string $relation_UUID
175
+	 * @throws EE_Error
176
+	 * @throws ReflectionException
177
+	 */
178
+	public function setBelongsTo(string $relation_UUID)
179
+	{
180
+		$this->set('FSC_UUID', $relation_UUID);
181
+	}
182
+
183
+
184
+	/**
185
+	 * returns a HelpText object for managing input help text
186
+	 *
187
+	 * @return HelpText
188
+	 * @throws EE_Error
189
+	 * @throws ReflectionException
190
+	 */
191
+	public function helpText(): ?HelpText
192
+	{
193
+		if (! $this->helpText instanceof HelpText) {
194
+			$this->helpText = HelpText::fromJson($this->get('FIN_helpText'));
195
+		}
196
+		return $this->helpText;
197
+	}
198
+
199
+
200
+	/**
201
+	 * @param HelpText $helpText
202
+	 * @throws EE_Error
203
+	 * @throws ReflectionException
204
+	 */
205
+	public function setHelpText(HelpText $helpText)
206
+	{
207
+		// set local object
208
+		$this->helpText = $helpText;
209
+		// then pass to model as an array which will get converted to JSON by the model field
210
+		$this->set('FIN_helpText', $helpText->toArray());
211
+	}
212
+
213
+
214
+	/**
215
+	 * returns a FormLabel object for managing input labels
216
+	 *
217
+	 * @return FormLabel
218
+	 * @throws EE_Error
219
+	 * @throws ReflectionException
220
+	 */
221
+	public function label(): ?FormLabel
222
+	{
223
+		if (! $this->label instanceof FormLabel) {
224
+			$this->label = FormLabel::fromJson($this->get('FIN_label'));
225
+		}
226
+		return $this->label;
227
+	}
228
+
229
+
230
+	/**
231
+	 * @param FormLabel $label
232
+	 * @throws EE_Error
233
+	 * @throws ReflectionException
234
+	 */
235
+	public function setLabel(FormLabel $label)
236
+	{
237
+		// set local object
238
+		$this->label = $label;
239
+		// then pass to model as an array which will get converted to JSON by the model field
240
+		$this->set('FIN_label', $label->toArray());
241
+	}
242
+
243
+
244
+	/**
245
+	 * Model and Fields name that this input maps to; ex: Attendee.email
246
+	 *
247
+	 * @return string
248
+	 * @throws EE_Error
249
+	 * @throws ReflectionException
250
+	 */
251
+	public function mapsTo(): ?string
252
+	{
253
+		return $this->get('FIN_mapsTo');
254
+	}
255
+
256
+
257
+	/**
258
+	 * @param string $model ex: Attendee
259
+	 * @param string $field ex: email
260
+	 * @throws EE_Error
261
+	 * @throws ReflectionException
262
+	 */
263
+	public function setMapsTo(string $model, string $field)
264
+	{
265
+		$model_name = strpos($model, 'EEM_') !== 0 ? "EEM_$model" : $model;
266
+		if (! class_exists($model_name)) {
267
+			throw new DomainException(
268
+				sprintf(
269
+					esc_html__(
270
+						'The %1$s model does not exist or can not be located. Please verify the spelling and whether it is loaded.',
271
+						'event_espresso'
272
+					),
273
+					$model_name
274
+				)
275
+			);
276
+		}
277
+		$this->set('FIN_mapsTo', "{$model}.{$field}");
278
+	}
279
+
280
+
281
+	/**
282
+	 * Options for ENUM type inputs like checkboxes, radio buttons, select inputs, etc
283
+	 *
284
+	 * @return InputOptions
285
+	 * @throws EE_Error
286
+	 * @throws ReflectionException
287
+	 */
288
+	public function options(): ?InputOptions
289
+	{
290
+		if (! $this->options instanceof InputOptions) {
291
+			$this->options = InputOptions::fromJson($this->get('FIN_options'));
292
+		}
293
+		return $this->options;
294
+	}
295
+
296
+
297
+	/**
298
+	 * @param InputOptions $options
299
+	 * @throws EE_Error
300
+	 * @throws ReflectionException
301
+	 */
302
+	public function setOptions(InputOptions $options)
303
+	{
304
+		// set local object
305
+		$this->options = $options;
306
+		// then pass to model as an array which will get converted to JSON by the model field
307
+		$this->set('FIN_options', $options->toArray());
308
+	}
309
+
310
+
311
+
312
+	/**
313
+	 * Order in which form input appears in a form.
314
+	 *
315
+	 * @return int
316
+	 * @throws EE_Error
317
+	 * @throws ReflectionException
318
+	 */
319
+	public function order(): int
320
+	{
321
+		return $this->get('FIN_order');
322
+	}
323
+
324
+
325
+	/**
326
+	 * @param int $order
327
+	 * @throws EE_Error
328
+	 * @throws ReflectionException
329
+	 */
330
+	public function setOrder(int $order)
331
+	{
332
+		$this->set('FIN_order', $order);
333
+	}
334
+
335
+
336
+	/**
337
+	 * Example text displayed within an input to assist users with completing the form.
338
+	 *
339
+	 * @return string
340
+	 * @throws EE_Error
341
+	 * @throws ReflectionException
342
+	 */
343
+	public function placeholder(): ?string
344
+	{
345
+		return $this->get('FIN_placeholder');
346
+	}
347
+
348
+
349
+	/**
350
+	 * @param string $placeholder
351
+	 * @throws EE_Error
352
+	 * @throws ReflectionException
353
+	 */
354
+	public function setPlaceholder(string $placeholder)
355
+	{
356
+		$this->set('FIN_placeholder', $placeholder);
357
+	}
358
+
359
+
360
+	/**
361
+	 * Whether or not the input must be supplied with a value in order to complete the form.
362
+	 *
363
+	 * @return Required
364
+	 * @throws EE_Error
365
+	 * @throws ReflectionException
366
+	 */
367
+	public function required(): ?Required
368
+	{
369
+		if (! $this->required instanceof Required) {
370
+			$this->required = Required::fromJson($this->get('FIN_required'));
371
+		}
372
+		return $this->required;
373
+	}
374
+
375
+
376
+	/**
377
+	 * @param Required $required
378
+	 * @throws EE_Error
379
+	 * @throws ReflectionException
380
+	 */
381
+	public function setRequired(Required $required)
382
+	{
383
+		// set local object
384
+		$this->required = $required;
385
+		// then pass to model as an array which will get converted to JSON by the model field
386
+		$this->set('FIN_required', $required->toArray());
387
+	}
388
+
389
+
390
+	/**
391
+	 * version of public label for use in identifiers
392
+	 *
393
+	 * @return string
394
+	 * @throws EE_Error
395
+	 * @throws ReflectionException
396
+	 */
397
+	public function slug(): ?string
398
+	{
399
+		return sanitize_title($this->label()->publicLabel());
400
+	}
401
+
402
+
403
+	/**
404
+	 * Whether form input is active, archived, trashed, or used as a default on new forms.
405
+	 * Values correspond to the EEM_Form_Element::STATUS_* constants.
406
+	 *
407
+	 * @return string
408
+	 * @throws EE_Error
409
+	 * @throws ReflectionException
410
+	 */
411
+	public function status(): string
412
+	{
413
+		return $this->get('FIN_status');
414
+	}
415
+
416
+
417
+	/**
418
+	 * Whether form input is active, archived, trashed, or used as a default on new forms.
419
+	 * Values correspond to the EEM_Form_Element::STATUS_* constants.
420
+	 *
421
+	 * @param string $status
422
+	 * @throws EE_Error
423
+	 * @throws ReflectionException
424
+	 */
425
+	public function setStatus(string $status)
426
+	{
427
+		$this->set('FIN_status', $status);
428
+	}
429
+
430
+
431
+	/**
432
+	 * Form input type.
433
+	 * Values correspond to the EventEspresso\core\domain\entities\form\Input::TYPE_* constants.
434
+	 *
435
+	 * @return string
436
+	 * @throws EE_Error
437
+	 * @throws ReflectionException
438
+	 */
439
+	public function type(): ?string
440
+	{
441
+		return $this->get('FIN_type');
442
+	}
443
+
444
+
445
+	/**
446
+	 * @param string $type
447
+	 * @throws EE_Error
448
+	 * @throws ReflectionException
449
+	 */
450
+	public function setType(string $type)
451
+	{
452
+		$this->set('FIN_type', $type);
453
+	}
454
+
455
+
456
+	/**
457
+	 * ID of the WP User that created this form input.
458
+	 *
459
+	 * @return int
460
+	 * @throws EE_Error
461
+	 * @throws ReflectionException
462
+	 */
463
+	public function wp_user(): int
464
+	{
465
+		return $this->get('FIN_wpUser');
466
+	}
467
+
468
+
469
+	/**
470
+	 * returns the id the wordpress user who created this question
471
+	 *
472
+	 * @param int $wp_user
473
+	 * @throws EE_Error
474
+	 * @throws ReflectionException
475
+	 */
476
+	public function setWpUser(int $wp_user)
477
+	{
478
+		$this->set('FIN_wpUser', $wp_user);
479
+	}
480
+
481
+
482
+	/**
483
+	 * @param array $set_cols_n_values
484
+	 * @return bool|int|string
485
+	 * @throws EE_Error
486
+	 * @throws ReflectionException
487
+	 */
488
+	public function save($set_cols_n_values = [])
489
+	{
490
+		// make sure internal versions for all composite objects are updated
491
+		$this->set('FIN_attributes', $this->attributes()->toArray());
492
+		$this->set('FIN_helpText', $this->helpText()->toArray());
493
+		$this->set('FIN_label', $this->label()->toArray());
494
+		$this->set('FIN_options', $this->options()->toArray());
495
+		$this->set('FIN_required', $this->required()->toArray());
496
+		return parent::save($set_cols_n_values);
497
+	}
498 498
 }
Please login to merge, or discard this patch.
core/domain/services/registration/form/v1/CopyAttendeeInfoForm.php 2 patches
Indentation   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -12,77 +12,77 @@
 block discarded – undo
12 12
 
13 13
 class CopyAttendeeInfoForm extends EE_Form_Section_Proper
14 14
 {
15
-    /**
16
-     * CopyAttendeeInfoForm constructor.
17
-     *
18
-     * @param EE_Registration[] $registrations
19
-     * @param string            $slug
20
-     * @throws EE_Error
21
-     * @throws ReflectionException
22
-     */
23
-    public function __construct(array $registrations, string $slug)
24
-    {
25
-        parent::__construct(
26
-            [
27
-                'subsections'     => $this->copyAttendeeInfoInputs($registrations),
28
-                'layout_strategy' => new EE_Template_Layout(
29
-                    [
30
-                        'layout_template_file'     => SPCO_REG_STEPS_PATH
31
-                                                      . $slug
32
-                                                      . '/copy_attendee_info.template.php',
33
-                        'begin_template_file'      => null,
34
-                        'input_template_file'      => null,
35
-                        'subsection_template_file' => null,
36
-                        'end_template_file'        => null,
37
-                    ]
38
-                ),
39
-            ]
40
-        );
41
-    }
15
+	/**
16
+	 * CopyAttendeeInfoForm constructor.
17
+	 *
18
+	 * @param EE_Registration[] $registrations
19
+	 * @param string            $slug
20
+	 * @throws EE_Error
21
+	 * @throws ReflectionException
22
+	 */
23
+	public function __construct(array $registrations, string $slug)
24
+	{
25
+		parent::__construct(
26
+			[
27
+				'subsections'     => $this->copyAttendeeInfoInputs($registrations),
28
+				'layout_strategy' => new EE_Template_Layout(
29
+					[
30
+						'layout_template_file'     => SPCO_REG_STEPS_PATH
31
+													  . $slug
32
+													  . '/copy_attendee_info.template.php',
33
+						'begin_template_file'      => null,
34
+						'input_template_file'      => null,
35
+						'subsection_template_file' => null,
36
+						'end_template_file'        => null,
37
+					]
38
+				),
39
+			]
40
+		);
41
+	}
42 42
 
43 43
 
44
-    /**
45
-     * @param array $registrations
46
-     * @return array
47
-     * @throws EE_Error
48
-     * @throws ReflectionException
49
-     */
50
-    private function copyAttendeeInfoInputs(array $registrations): array
51
-    {
52
-        $copy_attendee_info_inputs = [];
53
-        $prev_ticket               = null;
54
-        foreach ($registrations as $registration) {
55
-            // for all  attendees other than the primary attendee
56
-            if ($registration instanceof EE_Registration && ! $registration->is_primary_registrant()) {
57
-                // if this is a new ticket OR if this is the very first additional attendee after the primary attendee
58
-                if ($registration->ticket()->ID() !== $prev_ticket) {
59
-                    $item_name   = $registration->ticket()->name();
60
-                    $item_name   .= $registration->ticket()->description() !== ''
61
-                        ? ' - ' . $registration->ticket()->description()
62
-                        : '';
63
-                    $copy_attendee_info_inputs[ 'spco_copy_attendee_chk[ticket-' . $registration->ticket()->ID() . ']' ]
64
-                                 = new EE_Form_Section_HTML(
65
-                                     '<h6 class="spco-copy-attendee-event-hdr">' . $item_name . '</h6>'
66
-                                 );
67
-                    $prev_ticket = $registration->ticket()->ID();
68
-                }
44
+	/**
45
+	 * @param array $registrations
46
+	 * @return array
47
+	 * @throws EE_Error
48
+	 * @throws ReflectionException
49
+	 */
50
+	private function copyAttendeeInfoInputs(array $registrations): array
51
+	{
52
+		$copy_attendee_info_inputs = [];
53
+		$prev_ticket               = null;
54
+		foreach ($registrations as $registration) {
55
+			// for all  attendees other than the primary attendee
56
+			if ($registration instanceof EE_Registration && ! $registration->is_primary_registrant()) {
57
+				// if this is a new ticket OR if this is the very first additional attendee after the primary attendee
58
+				if ($registration->ticket()->ID() !== $prev_ticket) {
59
+					$item_name   = $registration->ticket()->name();
60
+					$item_name   .= $registration->ticket()->description() !== ''
61
+						? ' - ' . $registration->ticket()->description()
62
+						: '';
63
+					$copy_attendee_info_inputs[ 'spco_copy_attendee_chk[ticket-' . $registration->ticket()->ID() . ']' ]
64
+								 = new EE_Form_Section_HTML(
65
+									 '<h6 class="spco-copy-attendee-event-hdr">' . $item_name . '</h6>'
66
+								 );
67
+					$prev_ticket = $registration->ticket()->ID();
68
+				}
69 69
 
70
-                $copy_attendee_info_inputs[ 'spco_copy_attendee_chk[' . $registration->ID() . ']' ]
71
-                    = new EE_Checkbox_Multi_Input(
72
-                        [
73
-                        $registration->ID() => sprintf(
74
-                            esc_html_x('Attendee #%s', 'Attendee #123', 'event_espresso'),
75
-                            $registration->count()
76
-                        )
77
-                        ],
78
-                        [
79
-                            'html_id'                 => 'spco-copy-attendee-chk-' . $registration->reg_url_link(),
80
-                            'html_class'              => 'spco-copy-attendee-chk ee-do-not-validate',
81
-                            'display_html_label_text' => false,
82
-                        ]
83
-                    );
84
-            }
85
-        }
86
-        return $copy_attendee_info_inputs;
87
-    }
70
+				$copy_attendee_info_inputs[ 'spco_copy_attendee_chk[' . $registration->ID() . ']' ]
71
+					= new EE_Checkbox_Multi_Input(
72
+						[
73
+						$registration->ID() => sprintf(
74
+							esc_html_x('Attendee #%s', 'Attendee #123', 'event_espresso'),
75
+							$registration->count()
76
+						)
77
+						],
78
+						[
79
+							'html_id'                 => 'spco-copy-attendee-chk-' . $registration->reg_url_link(),
80
+							'html_class'              => 'spco-copy-attendee-chk ee-do-not-validate',
81
+							'display_html_label_text' => false,
82
+						]
83
+					);
84
+			}
85
+		}
86
+		return $copy_attendee_info_inputs;
87
+	}
88 88
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -56,18 +56,18 @@  discard block
 block discarded – undo
56 56
             if ($registration instanceof EE_Registration && ! $registration->is_primary_registrant()) {
57 57
                 // if this is a new ticket OR if this is the very first additional attendee after the primary attendee
58 58
                 if ($registration->ticket()->ID() !== $prev_ticket) {
59
-                    $item_name   = $registration->ticket()->name();
60
-                    $item_name   .= $registration->ticket()->description() !== ''
61
-                        ? ' - ' . $registration->ticket()->description()
59
+                    $item_name = $registration->ticket()->name();
60
+                    $item_name .= $registration->ticket()->description() !== ''
61
+                        ? ' - '.$registration->ticket()->description()
62 62
                         : '';
63
-                    $copy_attendee_info_inputs[ 'spco_copy_attendee_chk[ticket-' . $registration->ticket()->ID() . ']' ]
63
+                    $copy_attendee_info_inputs['spco_copy_attendee_chk[ticket-'.$registration->ticket()->ID().']']
64 64
                                  = new EE_Form_Section_HTML(
65
-                                     '<h6 class="spco-copy-attendee-event-hdr">' . $item_name . '</h6>'
65
+                                     '<h6 class="spco-copy-attendee-event-hdr">'.$item_name.'</h6>'
66 66
                                  );
67 67
                     $prev_ticket = $registration->ticket()->ID();
68 68
                 }
69 69
 
70
-                $copy_attendee_info_inputs[ 'spco_copy_attendee_chk[' . $registration->ID() . ']' ]
70
+                $copy_attendee_info_inputs['spco_copy_attendee_chk['.$registration->ID().']']
71 71
                     = new EE_Checkbox_Multi_Input(
72 72
                         [
73 73
                         $registration->ID() => sprintf(
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
                         )
77 77
                         ],
78 78
                         [
79
-                            'html_id'                 => 'spco-copy-attendee-chk-' . $registration->reg_url_link(),
79
+                            'html_id'                 => 'spco-copy-attendee-chk-'.$registration->reg_url_link(),
80 80
                             'html_class'              => 'spco-copy-attendee-chk ee-do-not-validate',
81 81
                             'display_html_label_text' => false,
82 82
                         ]
Please login to merge, or discard this patch.