PluginProbe ʕ •ᴥ•ʔ
Pods – Custom Content Types and Fields / 2.9.19.4
Pods – Custom Content Types and Fields v2.9.19.4
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 / ui / admin / setup-add.php
pods / ui / admin Last commit date
callouts 2 weeks ago upgrade 2 weeks ago widgets 2 weeks ago components-admin.php 2 weeks ago help-addons-row.php 2 weeks ago help-addons.php 2 weeks ago help.php 2 weeks ago postbox-header.php 2 weeks ago settings-reset.php 2 weeks ago settings-settings.php 2 weeks ago settings-tools.php 2 weeks ago settings.php 2 weeks ago setup-add.php 2 weeks ago setup-edit.php 2 weeks ago shortcode.php 2 weeks ago view.php 2 weeks ago
setup-add.php
594 lines
1 <?php
2 // Don't load directly.
3 if ( ! defined( 'ABSPATH' ) || ! pods_is_admin( 'pods' ) ) {
4 die( '-1' );
5 }
6
7 $pods_meta = pods_meta();
8
9 $ignore = [];
10
11 // Only add support for built-in taxonomy "link_category" if link manager is enabled.
12 $link_manager_enabled = (int) get_option( 'link_manager_enabled', 0 );
13
14 if ( 0 === $link_manager_enabled ) {
15 $ignore['link_category'] = true;
16 }
17
18 $all_pods = pods_api()->load_pods( [ 'key_names' => true ] );
19
20 $quick_actions = [];
21
22 if ( ! pods_is_types_only() ) {
23 if ( ! isset( $all_pods['post'] ) ) {
24 $quick_actions[] = [
25 'label' => __( 'Add custom fields to Posts', 'pods' ),
26 'create_extend' => 'extend',
27 'type' => 'post_type',
28 'object' => 'post',
29 ];
30 }
31
32 if ( ! isset( $all_pods['page'] ) ) {
33 $quick_actions[] = [
34 'label' => __( 'Add custom fields to Pages', 'pods' ),
35 'create_extend' => 'extend',
36 'type' => 'post_type',
37 'object' => 'page',
38 ];
39 }
40
41 if ( ! isset( $all_pods['category'] ) ) {
42 $quick_actions[] = [
43 'label' => __( 'Add custom fields to Categories', 'pods' ),
44 'create_extend' => 'extend',
45 'type' => 'taxonomy',
46 'object' => 'category',
47 ];
48 }
49
50 if ( ! isset( $all_pods['user'] ) ) {
51 $quick_actions[] = [
52 'label' => __( 'Add custom fields to Users', 'pods' ),
53 'create_extend' => 'extend',
54 'type' => 'user',
55 'object' => 'user',
56 ];
57 }
58 }
59
60 /**
61 * Allow filtering the list of quick actions.
62 *
63 * @since 2.8.0
64 *
65 * @param array $quick_actions List of quick actions with the following info: label, create_extend, type, object.
66 * @param array $all_pods List of pods, keyed by name.
67 */
68 $quick_actions = apply_filters( 'pods_admin_setup_add_quick_actions', $quick_actions, $all_pods );
69 ?>
70
71 <div class="wrap pods-admin">
72 <div id="icon-pods" class="icon32"><br /></div>
73
74 <form action="" method="post" class="pods-submittable">
75 <div class="pods-submittable-fields">
76 <input type="hidden" name="action" value="pods_admin" />
77 <input type="hidden" name="method" value="add_pod" />
78 <input type="hidden" name="_wpnonce" value="<?php echo esc_attr( wp_create_nonce( 'pods-add_pod' ) ); ?>" />
79 <input type="hidden" name="create_extend" id="pods_create_extend" value="create" />
80
81 <h2 class="italicized">
82 <?php
83 esc_html_e( 'Add New Pod', 'pods' );
84
85 if ( ! empty( $all_pods ) ) {
86 $link = pods_query_arg( [ 'page' => 'pods', 'action' . $obj->num => 'manage' ] );
87 ?>
88 <a href="<?php echo esc_url( $link ); ?>" class="add-new-h2">&laquo; <?php esc_html_e( 'Back to Manage', 'pods' ); ?></a>
89 <?php
90 }
91 ?>
92 </h2>
93
94 <img src="<?php echo esc_url( PODS_URL ); ?>ui/images/pods-logo-notext-rgb-transparent.png" class="pods-leaf-watermark-right" />
95
96 <div id="pods-wizard-box" class="pods-wizard-steps-2 pods-wizard-hide-first">
97 <div id="pods-wizard-heading">
98 <ul>
99 <li class="pods-wizard-menu-current" data-step="1">
100 <i></i> <span>1</span> <?php esc_html_e( 'Create or Extend', 'pods' ); ?>
101 <em></em>
102 </li>
103 <li data-step="2">
104 <i></i> <span>2</span> <?php esc_html_e( 'Configure', 'pods' ); ?>
105 <em></em>
106 </li>
107 </ul>
108 </div>
109 <div id="pods-wizard-main">
110 <div id="pods-wizard-panel-1" class="pods-wizard-panel">
111 <div class="pods-wizard-content">
112 <p>
113 <?php esc_html_e( 'Pods are content types that you can customize and define fields for based on your needs. You can choose to create a Custom Post Type, Custom Taxonomy, or Custom Settings Pages for site-specific data. You can also extend existing content types like WP Objects such as Post Types, Taxonomies, Users, or Comments.', 'pods' ); ?>
114 <br /><br />
115 <?php _e( 'Not sure what content type you should use? Check out our <a href="https://docs.pods.io/creating-editing-pods/compare-content-types/" target="_blank" rel="noopener noreferrer">Content Type Comparison</a> to help you decide.', 'pods' ); ?>
116 </p>
117
118 <?php if ( ! empty( $quick_actions ) ) : ?>
119 <h3><?php esc_html_e( 'One-Click Quick Actions', 'pods' ); ?></h3>
120
121 <ul class="normal">
122 <?php foreach ( $quick_actions as $quick_action ) : ?>
123 <li>
124 <a href="#<?php echo sanitize_title( $quick_action['create_extend'] . '-' . $quick_action['type'] . '-' . $quick_action['object'] ); ?>"
125 data-create-extend="<?php echo esc_attr( $quick_action['create_extend'] ); ?>"
126 data-object="<?php echo esc_attr( $quick_action['object'] ); ?>"
127 data-type="<?php echo esc_attr( $quick_action['type'] ); ?>"
128 class="pods-wizard-quick-action"
129 >
130 <?php echo esc_html( $quick_action['label'] ); ?>
131 </a>
132 </li>
133 <?php endforeach; ?>
134 </ul>
135 <?php endif; ?>
136 </div>
137 <div id="pods-wizard-options">
138 <h3><?php esc_html_e( 'Add New Pod Wizard', 'pods' ); ?></h3>
139
140 <div class="pods-wizard-options-list">
141 <div class="pods-wizard-option">
142 <a href="#pods-wizard-create" data-opt="create">
143 <h2><?php esc_html_e( 'Create New', 'pods' ); ?> &raquo;</h2>
144
145 <p><?php _e( 'Create entirely new content types using <strong>Post Types</strong>, <strong>Taxonomies</strong>, or <strong>Custom Settings Pages</strong>.', 'pods' ); ?></p>
146 </a>
147 </div>
148
149 <div class="pods-wizard-option">
150 <a href="#pods-wizard-extend" data-opt="extend">
151 <h2><?php esc_html_e( 'Extend Existing', 'pods' ); ?> &raquo;</h2>
152
153 <p><?php _e( 'Extend any existing content type within WordPress, including <strong>Post Types</strong> (Posts, Pages, etc), <strong>Taxonomies</strong> (Categories, Tags, etc), <strong>Media</strong>, <strong>Users</strong>, or <strong>Comments</strong>.', 'pods' ); ?></p>
154 </a>
155 </div>
156 </div>
157 </div>
158 </div>
159 <div id="pods-wizard-panel-2" class="pods-wizard-panel">
160 <div class="pods-wizard-option-content" id="pods-wizard-create">
161 <div class="pods-wizard-content">
162 <p><?php esc_html_e( 'Creating a new Content Type allows you to control exactly what that content type does, how it acts like, the fields it has, and the way you manage it.', 'pods' ); ?></p>
163 </div>
164 <div class="stuffbox">
165 <h3><label for="link_name"><?php esc_html_e( 'Create a New Content Type', 'pods' ); ?></label>
166 </h3>
167
168 <div class="inside pods-manage-field pods-dependency">
169 <div class="pods-field__container">
170 <?php
171 echo PodsForm::label( 'create_pod_type', __( 'Content Type', 'pods' ), [
172 __( '<h3>Content Types</h3> There are many content types to choose from, we have put together a comparison between them all to help you decide what fits your needs best.', 'pods' ),
173 'https://docs.pods.io/creating-editing-pods/compare-content-types/',
174 ] );
175
176 $data = [
177 'post_type' => __( 'Custom Post Type (like Posts or Pages)', 'pods' ),
178 'taxonomy' => __( 'Custom Taxonomy (like Categories or Tags)', 'pods' ),
179 'settings' => __( 'Custom Settings Page', 'pods' ),
180 'pod' => ''
181 // component will fill this in if it's enabled (this exists for placement)
182 ];
183
184 $data = apply_filters( 'pods_admin_setup_add_create_pod_type', $data );
185
186 if ( empty( $data['pod'] ) ) {
187 unset( $data['pod'] );
188 }
189
190 if ( pods_is_types_only() ) {
191 unset( $data['settings'], $data['pod'] );
192 }
193
194 echo PodsForm::field( 'create_pod_type', pods_v( 'create_pod_type', 'post', 'post_type', true ), 'pick', [
195 'data' => $data,
196 'pick_format_single' => 'dropdown',
197 'dependency' => true,
198 ] );
199 ?>
200 </div>
201 <div class="pods-field__container">
202 <?php
203 echo PodsForm::label( 'create_label_singular', __( 'Singular Label', 'pods' ), __( '<h3>Singular Label</h3> This is the label for 1 item (Singular) that will appear throughout the WordPress admin area for managing the content.', 'pods' ) );
204 echo PodsForm::field( 'create_label_singular', pods_v( 'create_label_singular', 'post' ), 'text', [
205 'class' => 'pods-validate pods-validate-required',
206 'text_max_length' => 30,
207 'excludes-on' => [
208 'create_pod_type' => 'settings',
209 ],
210 ] );
211 ?>
212 </div>
213 <div class="pods-field__container">
214 <?php
215 echo PodsForm::label( 'create_label_plural', __( 'Plural Label', 'pods' ), __( '<h3>Plural Label</h3> This is the label for more than 1 item (Plural) that will appear throughout the WordPress admin area for managing the content.', 'pods' ) );
216 echo PodsForm::field( 'create_label_plural', pods_v( 'create_label_plural', 'post' ), 'text', [
217 'text_max_length' => 30,
218 'excludes-on' => [
219 'create_pod_type' => 'settings',
220 ],
221 ] );
222 ?>
223 </div>
224 <div class="pods-field__container">
225 <?php
226 echo PodsForm::label( 'create_label_title', __( 'Page Title', 'pods' ), __( '<h3>Page Title</h3> This is the text that will appear at the top of your settings page.', 'pods' ) );
227 echo PodsForm::field( 'create_label_title', pods_v( 'create_label_title', 'post' ), 'text', [
228 'class' => 'pods-validate pods-validate-required',
229 'text_max_length' => 30,
230 'depends-on' => [
231 'create_pod_type' => 'settings',
232 ],
233 ] );
234 ?>
235 </div>
236 <div class="pods-field__container">
237 <?php
238 echo PodsForm::label( 'create_label_menu', __( 'Menu Label', 'pods' ), __( '<h3>Menu Label</h3> This is the label that will appear throughout the WordPress admin area for your settings.', 'pods' ) );
239 echo PodsForm::field( 'create_label_menu', pods_v( 'create_label_menu', 'post' ), 'text', [
240 'text_max_length' => 30,
241 'depends-on' => [
242 'create_pod_type' => 'settings',
243 ],
244 ] );
245 ?>
246 </div>
247 <div class="pods-field__container">
248 <?php
249 echo PodsForm::label( 'create_menu_location', __( 'Menu Location', 'pods' ), __( '<h3>Menu Location</h3> This is the location where the new settings page will be added in the WordPress Dashboard menu.', 'pods' ) );
250
251 $data = [
252 'settings' => __( 'Add to Settings menu', 'pods' ),
253 'appearances' => __( 'Add to Appearances menu', 'pods' ),
254 'top' => __( 'Make a new menu item below Settings', 'pods' ),
255 ];
256
257 echo PodsForm::field( 'create_menu_location', pods_v( 'create_menu_location', 'post' ), 'pick', [
258 'data' => $data,
259 'pick_format_single' => 'dropdown',
260 'depends-on' => [
261 'create_pod_type' => 'settings',
262 ],
263 ] );
264 ?>
265 </div>
266
267 <p>
268 <a href="#pods-advanced" class="pods-advanced-toggle"><?php esc_html_e( 'Advanced', 'pods' ); ?> +</a>
269 </p>
270
271 <div class="pods-advanced">
272 <div class="pods-field__container">
273 <?php
274 global $wpdb;
275 $max_length_name = 64;
276 $max_length_name -= 10; // Allow for WP Multisite or prefix changes in the future
277 $max_length_name -= strlen( $wpdb->prefix . 'pods_' );
278
279 echo PodsForm::label( 'create_name', __( 'Pod Name', 'pods' ), __( '<h3>Pod Identifier</h3> This is different than the labels users will see in the WordPress admin areas, it is the name you will use to programatically reference this object throughout your theme, WordPress, and other PHP.', 'pods' ) );
280 echo PodsForm::field( 'create_name', pods_v( 'create_name', 'post' ), 'slug', [
281 'attributes' => [
282 'maxlength' => $max_length_name,
283 'size' => 25,
284 ],
285 'excludes-on' => [
286 'create_pod_type' => 'settings',
287 ],
288 ] );
289 ?>
290 </div>
291 <div class="pods-field__container">
292 <?php
293 global $wpdb;
294 $max_length_name = 64;
295 $max_length_name -= 10; // Allow for WP Multisite or prefix changes in the future
296 $max_length_name -= strlen( $wpdb->prefix . 'pods_' );
297
298 echo PodsForm::label( 'create_setting_name', __( 'Pod Name', 'pods' ), __( '<h3>Pod Identifier</h3> This is different than the labels users will see in the WordPress admin areas, it is the name you will use to programatically reference this object throughout your theme, WordPress, and other PHP.', 'pods' ) );
299 echo PodsForm::field( 'create_setting_name', pods_v( 'create_setting_name', 'post' ), 'slug', [
300 'attributes' => [
301 'maxlength' => $max_length_name,
302 'size' => 25,
303 ],
304 'depends-on' => [
305 'create_pod_type' => 'settings',
306 ],
307 ] );
308 ?>
309 </div>
310 <div class="pods-field__container">
311 <?php
312 echo PodsForm::label( 'create_rest_api', __( 'Enable REST API', 'pods' ), __( 'This option will enable the REST API. For Custom Post Types, this will allow communication with the Block Editor. For Custom Taxonomies, this simply enables the REST API communication that can be taken advantage of by theme integrations.', 'pods' ) );
313 echo PodsForm::field( 'create_rest_api', pods_v( 'create_block_editor', 'post' ), 'boolean', [
314 'default' => 1,
315 'depends-on' => [
316 'create_pod_type' => [
317 'post_type',
318 'taxonomy',
319 ],
320 ],
321 ] );
322 ?>
323 </div>
324
325 <?php
326 if ( ! pods_tableless() && apply_filters( 'pods_admin_setup_add_create_storage', false ) ) {
327 ?>
328 <div class="pods-field__container">
329 <?php
330 echo PodsForm::label( 'create_storage', __( 'Storage Type', 'pods' ), [
331 __( '<h3>Storage Types</h3> Table based storage will operate in a way where each field you create for your content type becomes a field in a table. Meta based storage relies upon the WordPress meta storage table for all field data.', 'pods' ),
332 'https://docs.pods.io/creating-editing-pods/meta-vs-table-storage/',
333 ] );
334
335 $data = [
336 'meta' => __( 'Meta Based (WP Default)', 'pods' ),
337 'table' => __( 'Table Based', 'pods' ),
338 ];
339
340 echo PodsForm::field( 'create_storage', pods_v( 'create_storage', 'post' ), 'pick', [
341 'data' => $data,
342 'pick_format_single' => 'dropdown',
343 'depends-on' => [
344 'create_pod_type' => [
345 'post_type',
346 'taxonomy',
347 ],
348 ],
349 ] );
350 ?>
351 </div>
352 <?php
353 }
354 ?>
355 </div>
356 </div>
357 </div>
358 </div>
359 <div class="pods-wizard-option-content" id="pods-wizard-extend">
360 <div class="pods-wizard-content">
361 <p><?php esc_html_e( 'Extending an existing Content Type allows you to add fields to it and take advantage of the Pods architecture for management and optionally for theming.', 'pods' ); ?></p>
362 </div>
363 <div class="stuffbox">
364 <h3>
365 <label for="link_name"><?php esc_html_e( 'Extend an Existing Content Type', 'pods' ); ?></label>
366 </h3>
367
368 <div class="inside pods-manage-field pods-dependency">
369
370 <div class="pods-field__container">
371 <?php
372 echo PodsForm::label( 'extend_pod_type', __( 'Content Type', 'pods' ), [
373 __( '<h3>Content Types</h3> There are many content types to choose from, we have put together a comparison between them all to help you decide what fits your needs best.', 'pods' ),
374 'https://docs.pods.io/creating-editing-pods/compare-content-types/',
375 ] );
376
377 $data = [
378 'post_type' => __( 'Post Types (Posts, Pages, etc..)', 'pods' ),
379 'taxonomy' => __( 'Taxonomies (Categories, Tags, etc..)', 'pods' ),
380 'media' => __( 'Media', 'pods' ),
381 'user' => __( 'Users', 'pods' ),
382 'comment' => __( 'Comments', 'pods' ),
383 ];
384
385 if ( isset( $all_pods['media'] ) && 'media' == $all_pods['media']['type'] ) {
386 unset( $data['media'] );
387 }
388
389 if ( isset( $all_pods['user'] ) && 'user' == $all_pods['user']['type'] ) {
390 unset( $data['user'] );
391 }
392
393 if ( isset( $all_pods['comment'] ) && 'comment' == $all_pods['comment']['type'] ) {
394 unset( $data['comment'] );
395 }
396
397 $data = apply_filters( 'pods_admin_setup_add_extend_pod_type', $data );
398
399 echo PodsForm::field( 'extend_pod_type', pods_v( 'extend_pod_type', 'post', 'post_type', true ), 'pick', [
400 'data' => $data,
401 'pick_format_single' => 'dropdown',
402 'dependency' => true,
403 ] );
404 ?>
405 </div>
406 <div class="pods-field__container">
407 <?php
408 $post_types = get_post_types();
409
410 foreach ( $post_types as $post_type => $label ) {
411 if ( empty( $post_type ) || isset( $ignore[ $post_type ] ) || 0 === strpos( $post_type, '_pods_' ) || ! $pods_meta->is_type_covered( 'post_type', $post_type ) ) {
412 // Post type is ignored
413 unset( $post_types[ $post_type ] );
414
415 continue;
416 } elseif ( isset( $all_pods[ $post_type ] ) && 'post_type' === $all_pods[ $post_type ]['type'] ) {
417 unset( $post_types[ $post_type ] );
418
419 continue;
420 }
421
422 $post_type = get_post_type_object( $post_type );
423 $post_types[ $post_type->name ] = $post_type->label . ' (' . $post_type->name . ')';
424 }
425
426 /**
427 * Allow filtering the list of post types that can be extended by Pods.
428 *
429 * @since 2.9.17
430 *
431 * @param array<string,string> $post_types The list of post types.
432 */
433 $post_types = apply_filters( 'pods_admin_setup_add_extend_post_types', $post_types );
434
435 echo PodsForm::label( 'extend_post_type', __( 'Post Type', 'pods' ), [
436 __( '<h3>Post Types</h3> WordPress can hold and display many different types of content. Internally, these are all stored in the same place, in the wp_posts table. These are differentiated by a column called post_type.', 'pods' ),
437 'http://codex.wordpress.org/Post_Types',
438 ] );
439 echo PodsForm::field( 'extend_post_type', pods_v( 'extend_post_type', 'post' ), 'pick', [
440 'data' => $post_types,
441 'pick_format_single' => 'dropdown',
442 'depends-on' => [
443 'extend_pod_type' => 'post_type',
444 ],
445 ] );
446 ?>
447 </div>
448 <div class="pods-field__container">
449 <?php
450 $taxonomies = get_taxonomies();
451
452 foreach ( $taxonomies as $taxonomy => $label ) {
453 if ( empty( $taxonomy ) || isset( $ignore[ $taxonomy ] ) || 0 === strpos( $taxonomy, '_pods_' ) || ! $pods_meta->is_type_covered( 'taxonomy', $taxonomy ) ) {
454 // Taxonomy is ignored
455 unset( $taxonomies[ $taxonomy ] );
456
457 continue;
458 } elseif ( isset( $all_pods[ $taxonomy ] ) && 'taxonomy' == $all_pods[ $taxonomy ]['type'] ) {
459 unset( $taxonomies[ $taxonomy ] );
460 continue;
461 }
462
463 $taxonomy = get_taxonomy( $taxonomy );
464 $taxonomies[ $taxonomy->name ] = $taxonomy->label . ' (' . $taxonomy->name . ')';
465 }
466
467 /**
468 * Allow filtering the list of taxonomies that can be extended by Pods.
469 *
470 * @since 2.9.17
471 *
472 * @param array<string,string> $taxonomies The list of taxonomies.
473 */
474 $taxonomies = apply_filters( 'pods_admin_setup_add_extend_taxonomies', $taxonomies );
475
476 echo PodsForm::label( 'extend_taxonomy', __( 'Taxonomy', 'pods' ), [
477 __( '<h3>Taxonomies</h3> A taxonomy is a way to group Post Types.', 'pods' ),
478 'http://codex.wordpress.org/Taxonomies',
479 ] );
480 echo PodsForm::field( 'extend_taxonomy', pods_v( 'extend_taxonomy', 'post' ), 'pick', [
481 'data' => $taxonomies,
482 'pick_format_single' => 'dropdown',
483 'depends-on' => [
484 'extend_pod_type' => 'taxonomy',
485 ],
486 ] );
487 ?>
488 </div>
489
490 <?php
491 if ( ! pods_tableless() && apply_filters( 'pods_admin_setup_add_extend_storage', false ) ) {
492 ?>
493 <p>
494 <a href="#pods-advanced" class="pods-advanced-toggle"><?php esc_html_e( 'Advanced', 'pods' ); ?> +</a>
495 </p>
496
497 <div class="pods-advanced">
498 <div class="pods-field__container">
499 <?php
500 echo PodsForm::label( 'extend_storage', __( 'Storage Type', 'pods' ), [
501 __( '<h3>Storage Types</h3> Table based storage will operate in a way where each field you create for your content type becomes a field in a table. Meta based storage relies upon the WordPress meta storage table for all field data.', 'pods' ),
502 'https://docs.pods.io/creating-editing-pods/meta-vs-table-storage/',
503 ] );
504
505 $data = [
506 'meta' => __( 'Meta Based (WP Default)', 'pods' ),
507 'table' => __( 'Table Based', 'pods' ),
508 ];
509
510 echo PodsForm::field( 'extend_storage', pods_v( 'extend_storage', 'post' ), 'pick', [
511 'data' => $data,
512 'pick_format_single' => 'dropdown',
513 'depends-on' => [
514 'extend_pod_type' => [
515 'post_type',
516 'taxonomy',
517 'media',
518 'user',
519 'comment',
520 ],
521 ],
522 ] );
523 ?>
524 </div>
525 </div>
526 <?php
527 }
528 ?>
529 </div>
530 </div>
531 </div>
532 </div>
533
534 <div id="pods-wizard-actions" class="pods-wizard-button-interface">
535 <div id="pods-wizard-toolbar">
536 <button id="pods-wizard-start" class="button button-secondary"><?php esc_html_e( 'Start Over', 'pods' ); ?></button>
537 <button id="pods-wizard-next" class="button button-primary" data-next="<?php esc_attr_e( 'Next Step', 'pods' ); ?>" data-finished="<?php esc_attr_e( 'Finished', 'pods' ); ?>" data-processing="<?php esc_attr_e( 'Processing', 'pods' ); ?>.."><?php esc_html_e( 'Next Step', 'pods' ); ?></button>
538 </div>
539 <div id="pods-wizard-finished">
540
541 </div>
542 </div>
543 </div>
544 </div>
545 </div>
546 </form>
547 </div>
548 <script type="text/javascript">
549 var pods_admin_submit_callback = function ( id ) {
550 id = parseInt( id );
551
552 if ( !isNaN( id ) ) {
553 document.location = 'admin.php?page=pods&action=edit&id=' + id + '&do=create';
554 }
555 else {
556 document.location = 'admin.php?page=pods&do=create';
557 }
558 };
559
560 var pods_admin_option_select_callback = function ( $opt ) {
561 jQuery( '#pods_create_extend' ).val( $opt.data( 'opt' ) );
562 };
563
564 jQuery( function ( $ ) {
565 var $document = $( document );
566
567 $document.Pods( 'validate' );
568 $document.Pods( 'submit' );
569 $document.Pods( 'wizard' );
570 $document.Pods( 'advanced' );
571 $document.Pods( 'confirm' );
572 $document.Pods( 'sluggable' );
573
574 const $quick_actions = $( '.pods-wizard-quick-action' );
575
576 if ( $quick_actions[0] ) {
577 $quick_actions.on( 'click', function( e ) {
578 e.preventDefault();
579
580 const $action = $( this );
581 const createExtend = $action.data( 'create-extend' );
582 const objectName = $action.data( 'object' );
583 const objectType = $action.data( 'type' );
584
585 jQuery( '#pods_create_extend' ).val( createExtend );
586 jQuery( '#pods-form-ui-' + createExtend + '-pod-type' ).val( objectType );
587 jQuery( '#pods-form-ui-' + createExtend + '-' + objectType.replace( '_', '-' ) ).val( objectName );
588
589 $action.closest( 'form' ).submit();
590 } );
591 }
592 } );
593 </script>
594