PluginProbe ʕ •ᴥ•ʔ
Pods – Custom Content Types and Fields / 3.0.10.4
Pods – Custom Content Types and Fields v3.0.10.4
2.7.31.4 2.8.23.5 2.9.19.5 3.0.10.5 3.1.4.3 3.2.8.4 3.3.9.2 2.8.23.4 2.9.19.4 3.0.10.4 3.1.4.2 3.2.8.3 3.3.9.1 trunk 1.14.8 2.7.31.3 2.8.23.3 2.9.19.3 3.0.10.3 3.1.4.1 3.2.0 3.2.1 3.2.1.1 3.2.2 3.2.4 3.2.5 3.2.6 3.2.7 3.2.7.1 3.2.8 3.2.8.1 3.2.8.2 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9
pods / src / Pods / Admin / Config / Field.php
pods / src / Pods / Admin / Config Last commit date
Base.php 2 weeks ago Field.php 2 weeks ago Group.php 2 weeks ago Pod.php 2 weeks ago
Field.php
706 lines
1 <?php
2
3 namespace Pods\Admin\Config;
4
5 use PodsForm;
6
7 /**
8 * Field configuration class.
9 *
10 * @since 2.8.0
11 */
12 class Field extends Base {
13
14 /**
15 * Get list of tabs for the Field object.
16 *
17 * @since 2.8.0
18 *
19 * @param \Pods\Whatsit\Pod $pod The pod object.
20 *
21 * @return array List of tabs for the Field object.
22 */
23 public function get_tabs( \Pods\Whatsit\Pod $pod ) {
24 $repeatable_field_types = PodsForm::repeatable_field_types();
25
26 $core_tabs = [
27 'basic' => __( 'Field Details', 'pods' ),
28 ];
29
30 $field_types = PodsForm::field_types();
31
32 foreach ( $field_types as $type => $field_type_data ) {
33 $core_tabs[ 'additional-field-' . $type ] = [
34 'name' => 'additional-field-' . $type,
35 /* translators: %s: Field type label. */
36 'label' => sprintf( _x( '%s Options', 'Field type options', 'pods' ), $field_type_data['label'] ),
37 'depends-on' => [
38 'type' => $type,
39 ],
40 ];
41 }
42
43 $core_tabs['repeatable'] = [
44 'name' => 'repeatable',
45 'label' => __( 'Repeatable', 'pods' ),
46 'depends-on' => [
47 'type' => $repeatable_field_types,
48 ],
49 ];
50
51 $core_tabs['advanced'] = __( 'Advanced', 'pods' );
52 $core_tabs['conditional-logic'] = __( 'Conditional Logic', 'pods' );
53
54 // Only include kitchen sink if dev mode on and not running Codecept tests.
55 if ( pods_developer() && ! function_exists( 'codecept_debug' ) ) {
56 $core_tabs['kitchen-sink'] = __( 'Kitchen Sink (temp)', 'pods' );
57 }
58
59 $pod_type = $pod['type'];
60 $pod_name = $pod['name'];
61
62 $tabs = $core_tabs;
63
64 /**
65 * Filter the Pod Field option tabs for a specific pod type and name.
66 *
67 * @since 2.8.0
68 *
69 * @param array $core_tabs Tabs to set.
70 * @param \Pods\Whatsit\Pod $pod Current Pods object.
71 */
72 $tabs = (array) apply_filters( "pods_admin_setup_edit_field_tabs_{$pod_type}_{$pod_name}", $tabs, $pod );
73
74 /**
75 * Filter the Pod Field option tabs for a specific pod type.
76 *
77 * @since 2.8.0
78 *
79 * @param array $tabs Tabs to set.
80 * @param \Pods\Whatsit\Pod $pod Current Pods object.
81 */
82 $tabs = (array) apply_filters( "pods_admin_setup_edit_field_tabs_{$pod_type}", $tabs, $pod );
83
84 /**
85 * Filter the Pod Field option tabs.
86 *
87 * @since 2.8.0
88 *
89 * @param array $tabs Tabs to set.
90 * @param \Pods\Whatsit\Pod $pod Current Pods object.
91 */
92 $tabs = (array) apply_filters( 'pods_admin_setup_edit_field_tabs', $tabs, $pod );
93
94 // Sort and then enforce the core tabs to be in front.
95 uksort( $tabs, 'strnatcmp' );
96
97 $tabs = array_merge( $core_tabs, $tabs );
98
99 return $tabs;
100 }
101
102 /**
103 * Get list of fields for the Field object.
104 *
105 * @since 2.8.0
106 *
107 * @param \Pods\Whatsit\Pod $pod The pod object.
108 * @param array $tabs The list of tabs for the pod object.
109 *
110 * @return array List of fields for the Field object.
111 */
112 public function get_fields( \Pods\Whatsit\Pod $pod, array $tabs ) {
113 $field_types = PodsForm::field_types();
114 $tableless_field_types = PodsForm::tableless_field_types();
115 $repeatable_field_types = PodsForm::repeatable_field_types();
116 $separator_excluded_field_types = PodsForm::separator_excluded_field_types();
117 $layout_non_input_field_types = PodsForm::layout_field_types() + PodsForm::non_input_field_types();
118
119 // Remove repeatable fields custom separator options.
120 $serial_repeatable_field_types = array_values( array_diff( $repeatable_field_types, $separator_excluded_field_types ) );
121
122 $options = [];
123
124 $options['basic'] = [
125 'label' => [
126 'name' => 'label',
127 'label' => __( 'Label', 'pods' ),
128 'type' => 'text',
129 'default' => '',
130 'help' => 'help',
131 'required' => true,
132 ],
133 'name' => [
134 'name' => 'name',
135 'label' => __( 'Name', 'pods' ),
136 'type' => 'slug',
137 'default' => '',
138 'attributes' => [
139 'maxlength' => 50,
140 ],
141 'help' => 'help',
142 'required' => true,
143 ],
144 'description' => [
145 'name' => 'description',
146 'label' => __( 'Description', 'pods' ),
147 'type' => 'text',
148 'default' => '',
149 'help' => 'help',
150 ],
151 'type' => [
152 'name' => 'type',
153 'label' => __( 'Field Type', 'pods' ),
154 'type' => 'pick',
155 'default' => 'text',
156 'required' => true,
157 'data' => [],
158 'pick_format_single' => 'dropdown',
159 'dependency' => true,
160 'help' => 'help',
161 ],
162 'pick_object' => [
163 'name' => 'pick_object',
164 'label' => __( 'Related Type', 'pods' ),
165 'type' => 'pick',
166 'default' => 'custom-simple',
167 'required' => true,
168 'data' => [],
169 'pick_format_single' => 'dropdown',
170 'pick_show_select_text' => 0,
171 'dependency' => true,
172 'depends-on' => [
173 'type' => 'pick',
174 ],
175 'help' => 'help',
176 ],
177 'pick_custom' => [
178 'name' => 'pick_custom',
179 'label' => __( 'Custom Defined Options', 'pods' ),
180 'type' => 'paragraph',
181 'default' => '',
182 'required' => true,
183 'depends-on' => [
184 'type' => 'pick',
185 'pick_object' => 'custom-simple',
186 ],
187 'help' => __( 'One option per line, use <em>value|Label</em> for separate values and labels', 'pods' ),
188 ],
189 'pick_table' => [
190 'name' => 'pick_table',
191 'label' => __( 'Related Table', 'pods' ),
192 'type' => 'pick',
193 'default' => '',
194 'data' => [],
195 'pick_format_single' => 'dropdown',
196 'pick_show_select_text' => 0,
197 'depends-on' => [
198 'type' => 'pick',
199 'pick_object' => 'table',
200 ],
201 'help' => 'help',
202 ],
203 'sister_id' => [
204 'name' => 'sister_id',
205 'label' => __( 'Bi-directional Field', 'pods' ),
206 'type' => 'pick',
207 'default' => '',
208 'data' => [],
209 'pick_format_single' => 'dropdown',
210 'depends-on' => [
211 'type' => 'pick',
212 'pick_object' => PodsForm::field_method( 'pick', 'bidirectional_objects' ),
213 ],
214 'help' => __( 'Bi-directional fields will update their related field for any item you select. This feature is only available for two relationships between two Pods.<br /><br />For example, when you update a Parent pod item to relate to a Child item, when you go to edit that Child item you will see the Parent pod item selected.', 'pods' ),
215 ],
216 'required' => [
217 'name' => 'required',
218 'label' => __( 'Required', 'pods' ),
219 'type' => 'boolean',
220 'default' => 0,
221 'boolean_yes_label' => '',
222 'excludes-on' => [
223 'type' => $layout_non_input_field_types,
224 ],
225 'help' => __( 'This will require a non-empty value to be entered.', 'pods' ),
226 ],
227 'required_help_boolean' => [
228 'name' => 'required_help_boolean',
229 'label' => '',
230 'type' => 'html',
231 'default' => 0,
232 'html_content' => '<p><em>' . esc_html__( 'Please note: When Yes/No fields are required, the field must be set to Yes (checked) to be able to submit the form.', 'pods' ) . '</em></p>',
233 'dependency' => true,
234 'depends-on' => [
235 'required' => true,
236 'type' => 'boolean',
237 ],
238 ],
239 ];
240
241 $options['repeatable'] = [
242 'repeatable' => [
243 'name' => 'repeatable',
244 'label' => __( 'Repeatable', 'pods' ),
245 'default' => 0,
246 'type' => 'boolean',
247 'help' => __( 'Making a field repeatable will add controls next to the field which allows users to Add / Remove / Reorder additional values.', 'pods' ),
248 'boolean_yes_label' => __( 'Allow multiple values', 'pods' ),
249 'dependency' => true,
250 'depends-on' => [
251 'type' => $repeatable_field_types,
252 ],
253 ],
254 'repeatable_add_new_label' => [
255 'name' => 'repeatable_add_new_label',
256 'label' => __( 'Repeatable - Add New Label', 'pods' ),
257 'placeholder' => __( 'Add New', 'pods' ),
258 'default' => '',
259 'type' => 'text',
260 'depends-on' => [
261 'type' => $repeatable_field_types,
262 'repeatable' => true,
263 ],
264 ],
265 'repeatable_format' => [
266 'label' => __( 'Repeatable - Display Format', 'pods' ),
267 'help' => __( 'Used as format for front-end display', 'pods' ),
268 'depends-on' => [
269 'type' => $serial_repeatable_field_types,
270 'repeatable' => true,
271 ],
272 'default' => 'default',
273 'required' => true,
274 'type' => 'pick',
275 'data' => [
276 'default' => __( 'Item 1, Item 2, and Item 3', 'pods' ),
277 'non_serial' => __( 'Item 1, Item 2 and Item 3', 'pods' ),
278 'br' => __( 'Line breaks', 'pods' ),
279 'ul' => __( 'Unordered list', 'pods' ),
280 'ol' => __( 'Ordered list', 'pods' ),
281 'custom' => __( 'Custom separator (without "and")', 'pods' ),
282 ],
283 'pick_format_single' => 'dropdown',
284 'pick_show_select_text' => 0,
285 'dependency' => true,
286 ],
287 'repeatable_format_separator' => [
288 'label' => __( 'Repeatable - Display Format Separator', 'pods' ),
289 'help' => __( 'Used as separator for front-end display. Be sure to include exactly the spaces that you need since the separator is used literally between values. For example, you would use ", " to have values like "One, Two, Three". You would also use " | " to have values like "One | Two | Three".', 'pods' ),
290 'description' => __( 'This option will default to ", "', 'pods' ),
291 'depends-on' => [
292 'type' => $serial_repeatable_field_types,
293 'repeatable' => true,
294 'repeatable_format' => 'custom',
295 ],
296 'placeholder' => '',
297 'type' => 'text',
298 ],
299 ];
300
301 $options['advanced'] = [
302 'visual' => [
303 'name' => 'visual',
304 'label' => __( 'Visual', 'pods' ),
305 'type' => 'heading',
306 ],
307 'class' => [
308 'name' => 'class',
309 'label' => __( 'Additional CSS Classes', 'pods' ),
310 'help' => __( 'You can provide additional CSS classes separated by spaces to be output for the field markup.', 'pods' ),
311 'type' => 'text',
312 'default' => '',
313 ],
314 'values' => [
315 'name' => 'values',
316 'label' => __( 'Values', 'pods' ),
317 'type' => 'heading',
318 'excludes-on' => [
319 'type' => $layout_non_input_field_types,
320 ],
321 ],
322 'default_value' => [
323 'name' => 'default_value',
324 'label' => __( 'Default Value', 'pods' ),
325 'help' => __( 'This is the default value used when the Add New form is used.', 'pods' ),
326 'type' => 'text',
327 'default' => '',
328 'text_max_length' => - 1,
329 'excludes-on' => [
330 'type' => $layout_non_input_field_types,
331 ],
332 ],
333 'default_value_parameter' => [
334 'name' => 'default_value_parameter',
335 'label' => __( 'Set Default Value via Parameter', 'pods' ),
336 'help' => __( 'You can automatically populate the value of this field from the URL parameter "your_field" such as ?your_field=1234', 'pods' ),
337 'type' => 'text',
338 'default' => '',
339 'excludes-on' => [
340 'type' => $layout_non_input_field_types,
341 ],
342 ],
343 'visibility' => [
344 'name' => 'visibility',
345 'label' => __( 'Visibility', 'pods' ),
346 'type' => 'heading',
347 ],
348 'restrict_access' => [
349 'type' => 'boolean_group',
350 'name' => 'restrict_access',
351 'label' => __( 'Restrict Access', 'pods' ),
352 'boolean_group' => [
353 'logged_in_only' => [
354 'name' => 'logged_in_only',
355 'label' => __( 'Restrict access to Logged In Users', 'pods' ),
356 'default' => 0,
357 'type' => 'boolean',
358 'dependency' => true,
359 'help' => __( 'This field will only be able to be edited by logged in users. This is not required to be on for the other Restrict Access options to work.', 'pods' ),
360 ],
361 'admin_only' => [
362 'name' => 'admin_only',
363 'label' => __( 'Restrict access to Admins', 'pods' ),
364 'default' => 0,
365 'type' => 'boolean',
366 'dependency' => true,
367 'help' => __( 'This field will only be able to be edited by users with the ability to manage_options or delete_users, or super admins of a WordPress Multisite network', 'pods' ),
368 ],
369 'restrict_role' => [
370 'name' => 'restrict_role',
371 'label' => __( 'Restrict access by Role', 'pods' ),
372 'default' => 0,
373 'type' => 'boolean',
374 'dependency' => true,
375 ],
376 'restrict_capability' => [
377 'name' => 'restrict_capability',
378 'label' => __( 'Restrict access by Capability', 'pods' ),
379 'default' => 0,
380 'type' => 'boolean',
381 'dependency' => true,
382 ],
383 'hidden' => [
384 'name' => 'hidden',
385 'label' => __( 'Hide field from UI', 'pods' ),
386 'default' => 0,
387 'type' => 'boolean',
388 'help' => __( 'This option is overridden by access restrictions. If the user does not have access to edit this field, it will be hidden. If no access restrictions are set, this field will always be hidden.', 'pods' ),
389 ],
390 'read_only' => [
391 'name' => 'read_only',
392 'label' => __( 'Make field "Read Only" in UI', 'pods' ),
393 'default' => 0,
394 'type' => 'boolean',
395 'help' => __( 'This option is overridden by access restrictions. If the user does not have access to edit this field, it will be read only. If no access restrictions are set, this field will always be read only. This does not prevent the field from being changed manually through HTML DOM manipulation, this just shows the field as a read-only text field that cannot be normally changed without developer intervention.', 'pods' ),
396 'depends-on' => [
397 'type' => [
398 'boolean',
399 'color',
400 'currency',
401 'date',
402 'datetime',
403 'email',
404 'number',
405 'paragraph',
406 'password',
407 'phone',
408 'slug',
409 'text',
410 'time',
411 'website',
412 ],
413 ],
414 ],
415 ],
416 ],
417 'roles_allowed' => [
418 'name' => 'roles_allowed',
419 'label' => __( 'Role(s) Allowed', 'pods' ),
420 'help' => __( 'help', 'pods' ),
421 'type' => 'pick',
422 'pick_object' => 'role',
423 'pick_format_type' => 'multi',
424 'default' => 'administrator',
425 'depends-on' => [
426 'restrict_role' => true,
427 ],
428 'help' => __( 'If none are selected, this option will be ignored.', 'pods' ),
429 ],
430 'capability_allowed' => [
431 'name' => 'capability_allowed',
432 'label' => __( 'Capability Allowed', 'pods' ),
433 'help' => __( 'Comma-separated list of capabilities, for example add_podname_item, please see the Roles and Capabilities component for the complete list and a way to add your own.', 'pods' ),
434 'type' => 'text',
435 'default' => '',
436 'depends-on' => [
437 'restrict_capability' => true,
438 ],
439 'help' => __( 'If none are selected, this option will be ignored.', 'pods' ),
440 ],
441 ];
442
443 $options['conditional-logic'] = [
444 'enable_conditional_logic' => [
445 'name' => 'enable_conditional_logic',
446 'label' => __( 'Enable Conditional Logic', 'pods' ),
447 'help' => __( 'Conditional logic can automatically show or hide this field depending on the value of other fields.', 'pods' ),
448 'type' => 'boolean',
449 'default' => 0,
450 ],
451 'conditional_logic' => [
452 'name' => 'conditional_logic',
453 'label' => __( 'Conditions', 'pods' ),
454 'help' => __( 'help', 'pods' ),
455 'type' => 'conditional-logic',
456 'depends-on' => [
457 'enable_conditional_logic' => true,
458 ],
459 ],
460 'conditional_logic_help' => [
461 'name' => 'conditional_logic_help',
462 'label' => '',
463 'help' => __( 'help', 'pods' ),
464 'type' => 'html',
465 'html_content' => wpautop(
466 sprintf(
467 '
468 %1$s
469
470 <ul>
471 <li>%2$s</li>
472 <li>%3$s</li>
473 </ul>
474
475 <a href="https://docs.pods.io/fields/conditional-logic-for-fields/">%4$s &raquo;</a>
476 ',
477 __( 'Each field type has their own conditional options available to them.', 'pods' ),
478 __( 'For pattern matching on text-based fields: Use Regular Expressions and do not use the wrapping character "/" like "/[a-z]/", you will need to use "[a-z]"', 'pods' ),
479 __( 'For relationships: Use the ID for any relationship object or the text value for any custom defined / simple relationship', 'pods' ),
480 __( 'Learn more about conditional logic for fields', 'pods' )
481 )
482 ),
483 'depends-on' => [
484 'enable_conditional_logic' => true,
485 ],
486 ],
487 ];
488
489 $pick_tables = pods_transient_get( 'pods_tables' );
490
491 if ( empty( $pick_tables ) ) {
492 $pick_tables = [
493 '' => __( '-- Select Table --', 'pods' ),
494 ];
495
496 global $wpdb;
497
498 $tables = $wpdb->get_results( 'SHOW TABLES', ARRAY_N );
499
500 if ( ! empty( $tables ) ) {
501 foreach ( $tables as $table ) {
502 $pick_tables[ $table[0] ] = $table[0];
503 }
504 }
505
506 pods_transient_set( 'pods_tables', $pick_tables, WEEK_IN_SECONDS );
507 }
508
509 $field_settings = [
510 'field_types_select' => [],
511 'pick_object' => PodsForm::field_method( 'pick', 'related_objects', true ),
512 'pick_table' => $pick_tables,
513 'sister_id' => [
514 '' => __( 'No Related Fields Found', 'pods' ),
515 ],
516 ];
517
518 $pod_name = $pod['name'];
519 $pod_type = $pod['type'];
520
521 foreach ( $field_types as $type => $field_type_data ) {
522 /**
523 * @var $field_type PodsField
524 */
525 $field_type_object = PodsForm::field_loader( $type, $field_type_data['file'] );
526
527 $field_type_vars = get_class_vars( get_class( $field_type_object ) );
528
529 if ( ! isset( $field_type_vars['pod_types'] ) ) {
530 $field_type_vars['pod_types'] = true;
531 }
532
533 $options[ 'additional-field-' . $type ] = [];
534
535 // Only show supported field types
536 if ( true !== $field_type_vars['pod_types'] ) {
537 if ( empty( $field_type_vars['pod_types'] ) ) {
538 continue;
539 } elseif ( is_array( $field_type_vars['pod_types'] ) && ! in_array( $pod_type, $field_type_vars['pod_types'], true ) ) {
540 continue;
541 } elseif ( ! is_array( $field_type_vars['pod_types'] ) && $pod_type !== $field_type_vars['pod_types'] ) {
542 continue;
543 }
544 }
545
546 if ( ! empty( PodsForm::$field_group ) ) {
547 if ( ! isset( $field_settings['field_types_select'][ PodsForm::$field_group ] ) ) {
548 $field_settings['field_types_select'][ PodsForm::$field_group ] = [];
549 }
550
551 $field_settings['field_types_select'][ PodsForm::$field_group ][ $type ] = $field_type_data['label'];
552 } else {
553 if ( ! isset( $field_settings['field_types_select'][ __( 'Other', 'pods' ) ] ) ) {
554 $field_settings['field_types_select'][ __( 'Other', 'pods' ) ] = [];
555 }
556
557 $field_settings['field_types_select'][ __( 'Other', 'pods' ) ][ $type ] = $field_type_data['label'];
558 }
559
560 $type_options = PodsForm::ui_options( $type );
561
562 $dev_mode = pods_developer();
563
564 if ( ! $dev_mode ) {
565 foreach ( $type_options as $type_option => $option_data ) {
566 if ( ! empty( $option_data['developer_mode'] ) ) {
567 unset( $type_options[ $type_option ] );
568 }
569 }
570 }
571
572 /**
573 * Modify Additional Field Options tab
574 *
575 * @since 2.7.0
576 *
577 * @param array $type_options Additional field type options,
578 * @param string $type Field type,
579 * @param array $options Tabs, indexed by label,
580 * @param null|\Pods\Whatsit\Pod $pod Pods object for the Pod this UI is for.
581 */
582 $type_options = apply_filters( "pods_admin_setup_edit_{$type}_additional_field_options", $type_options, $type, $options, $pod );
583 $type_options = apply_filters( 'pods_admin_setup_edit_additional_field_options', $type_options, $type, $options, $pod );
584
585 $options[ 'additional-field-' . $type ] = $type_options;
586 }//end foreach
587
588 /**
589 * Allow filtering the field settings by pod name.
590 *
591 * @param array $field_settings List of field settings to use.
592 * @param null|\Pods\Whatsit\Pod $pod Pods object for the Pod this UI is for.
593 * @param array $tabs List of registered tabs
594 */
595 $field_settings = apply_filters( "pods_field_settings_{$pod_name}", $field_settings, $pod );
596
597 /**
598 * Allow filtering the field settings by pod name.
599 *
600 * @param array $field_settings List of field settings to use.
601 * @param null|\Pods\Whatsit\Pod $pod Pods object for the Pod this UI is for.
602 * @param array $tabs List of registered tabs
603 */
604 $field_settings = apply_filters( 'pods_field_settings', $field_settings, $pod, $tabs );
605
606 $options['basic']['type']['data'] = $field_settings['field_types_select'];
607 $options['basic']['pick_object']['data'] = $field_settings['pick_object'];
608 $options['basic']['pick_table']['data'] = $field_settings['pick_table'];
609
610 // @todo Look into supporting these in the future.
611 /*
612 'search' => [
613 'label' => __( 'Include in searches', 'pods' ),
614 'help' => __( 'help', 'pods' ),
615 'default' => 1,
616 'type' => 'boolean',
617 ],
618 'regex_validation' => [
619 'label' => __( 'RegEx Validation', 'pods' ),
620 'help' => __( 'help', 'pods' ),
621 'type' => 'text',
622 'default' => '',
623 ],
624 'message_regex' => [
625 'label' => __( 'Message if field does not pass RegEx', 'pods' ),
626 'help' => __( 'help', 'pods' ),
627 'type' => 'text',
628 'default' => '',
629 ],
630 'message_required' => [
631 'label' => __( 'Message if field is blank', 'pods' ),
632 'help' => __( 'help', 'pods' ),
633 'type' => 'text',
634 'default' => '',
635 'depends-on' => [ 'required' => true ],
636 ],
637 'message_unique' => [
638 'label' => __( 'Message if field is not unique', 'pods' ),
639 'help' => __( 'help', 'pods' ),
640 'type' => 'text',
641 'default' => '',
642 'depends-on' => [ 'unique' => true ],
643 ],
644 */
645
646 if ( 'table' === $pod['storage'] || 'pod' === $pod['type'] ) {
647 unset( $options['basic']['repeatable'] );
648
649 $options['basic']['unique'] = [
650 'name' => 'unique',
651 'label' => __( 'Unique', 'pods' ),
652 'type' => 'boolean',
653 'default' => 0,
654 'boolean_yes_label' => '',
655 'help' => __( 'This will require that the field value entered is unique and has not been saved before.', 'pods' ),
656 'excludes-on' => [
657 'type' => $tableless_field_types,
658 ],
659 ];
660 }
661
662 // Only include kitchen sink if dev mode on and not running Codecept tests.
663 if ( pods_developer() && ! function_exists( 'codecept_debug' ) ) {
664 $options['kitchen-sink'] = json_decode( file_get_contents( PODS_DIR . 'tests/codeception/_data/kitchen-sink-config.json' ), true );
665 }
666
667 $pod_type = $pod['type'];
668 $pod_name = $pod['name'];
669
670 /**
671 * Add admin fields to the Pod Fields editor for a specific Pod.
672 *
673 * @since 2.8.0
674 *
675 * @param array $options The Options fields.
676 * @param \Pods\Whatsit\Pod $pod Current Pods object.
677 * @param array $tabs List of registered tabs.
678 */
679 $options = apply_filters( "pods_admin_setup_edit_field_options_{$pod_type}_{$pod_name}", $options, $pod, $tabs );
680
681 /**
682 * Add admin fields to the Pod Fields editor for any Pod of a specific content type.
683 *
684 * @since 2.8.0
685 *
686 * @param array $options The Options fields.
687 * @param \Pods\Whatsit\Pod $pod Current Pods object.
688 * @param array $tabs List of registered tabs.
689 */
690 $options = apply_filters( "pods_admin_setup_edit_field_options_{$pod_type}", $options, $pod, $tabs );
691
692 /**
693 * Add admin fields to the Pod Fields editor for all Pods.
694 *
695 * @since 2.8.0
696 *
697 * @param array $options The Options fields.
698 * @param \Pods\Whatsit\Pod $pod Current Pods object.
699 * @param array $tabs List of registered tabs.
700 */
701 $options = apply_filters( 'pods_admin_setup_edit_field_options', $options, $pod, $tabs );
702
703 return $options;
704 }
705 }
706