PluginProbe ʕ •ᴥ•ʔ
Pods – Custom Content Types and Fields / 3.3.4
Pods – Custom Content Types and Fields v3.3.4
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 1 year ago upgrade 2 years ago widgets 2 years ago components-admin.php 2 years ago help-addons-row.php 2 years ago help-addons.php 2 years ago help.php 2 years ago postbox-header.php 2 years ago settings-reset.php 9 months ago settings-settings.php 11 months ago settings-tools.php 2 years ago settings.php 2 years ago setup-add.php 11 months ago setup-edit.php 2 years ago shortcode.php 2 years ago view.php 2 years ago
setup-add.php
659 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['post_type-post'] = [
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['post_type-page'] = [
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['taxonomy-category'] = [
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['user'] = [
52 'label' => __( 'Add custom fields to Users', 'pods' ),
53 'create_extend' => 'extend',
54 'type' => 'user',
55 'object' => 'user',
56 ];
57 }
58 }
59
60 $extend_post_type_linked = pods_v( 'pods_extend_post_type' );
61 $extend_post_type_nonce = pods_v( 'pods_extend_post_type_nonce' );
62
63 $submit_from_linked = false;
64
65 if ( $extend_post_type_linked && wp_verify_nonce( $extend_post_type_nonce, 'pods_extend_post_type_' . $extend_post_type_linked ) ) {
66 $submit_from_linked = 'post_type-' . $extend_post_type_linked;
67
68 $quick_actions[ $submit_from_linked ] = [
69 // Translators: %s is the post type name (not label).
70 'label' => sprintf( __( 'Extend Post Type: %s', 'pods' ), $extend_post_type_linked ),
71 'create_extend' => 'extend',
72 'type' => 'post_type',
73 'object' => $extend_post_type_linked,
74 ];
75 }
76
77 /**
78 * Allow filtering the list of quick actions.
79 *
80 * @since 2.8.0
81 *
82 * @param array $quick_actions List of quick actions with the following info: label, create_extend, type, object.
83 * @param array $all_pods List of pods, keyed by name.
84 */
85 $quick_actions = apply_filters( 'pods_admin_setup_add_quick_actions', $quick_actions, $all_pods );
86 ?>
87
88 <div class="wrap pods-admin">
89 <div id="icon-pods" class="icon32"><br /></div>
90
91 <form action="" method="post" class="pods-submittable">
92 <div class="pods-submittable-fields">
93 <input type="hidden" name="action" value="pods_admin" />
94 <input type="hidden" name="method" value="add_pod" />
95 <input type="hidden" name="_wpnonce" value="<?php echo esc_attr( wp_create_nonce( 'pods-add_pod' ) ); ?>" />
96 <input type="hidden" name="create_extend" id="pods_create_extend" value="create" />
97
98 <h2 class="italicized">
99 <?php
100 esc_html_e( 'Add New Pod', 'pods' );
101
102 if ( ! empty( $all_pods ) ) {
103 $link = pods_query_arg( [ 'page' => 'pods', 'action' . $obj->num => 'manage' ] );
104 ?>
105 <a href="<?php echo esc_url( $link ); ?>" class="add-new-h2">&laquo; <?php esc_html_e( 'Back to Manage', 'pods' ); ?></a>
106 <?php
107 }
108 ?>
109 </h2>
110
111 <img src="<?php echo esc_url( PODS_URL ); ?>ui/images/pods-logo-notext-rgb-transparent.png" class="pods-leaf-watermark-right" />
112
113 <div id="pods-wizard-box" class="pods-wizard-steps-2 pods-wizard-hide-first">
114 <div id="pods-wizard-heading">
115 <ul>
116 <li class="pods-wizard-menu-current" data-step="1">
117 <i></i> <span>1</span> <?php esc_html_e( 'Step 1: Create or Extend', 'pods' ); ?>
118 <em></em>
119 </li>
120 <li data-step="2">
121 <i></i> <span>2</span> <?php esc_html_e( 'Step 2: Configure', 'pods' ); ?>
122 <em></em>
123 </li>
124 </ul>
125 </div>
126 <div id="pods-wizard-main">
127 <div id="pods-wizard-panel-1" class="pods-wizard-panel">
128 <div class="pods-wizard-content">
129 <p>
130 <?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' ); ?>
131 <br /><br />
132 <?php echo wp_kses_post( __( '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' ) ); ?>
133 </p>
134 </div>
135 <div id="pods-wizard-options">
136 <div class="pods-wizard-options-list">
137 <div class="pods-wizard-option">
138 <a href="#pods-wizard-create" data-opt="create">
139 <div>
140 <h2><?php esc_html_e( 'Create a new Content Type', 'pods' ); ?></h2>
141 <p><?php echo wp_kses_post( __( 'Create entirely new content types using <strong>Post Types</strong>, <strong>Taxonomies</strong>, or <strong>Custom Settings Pages</strong>.', 'pods' ) ); ?></p>
142 </div>
143 <span>&#10095;</span>
144 </a>
145 </div>
146
147 <div class="pods-wizard-option<?php echo ! empty( $quick_actions ) ? ' pods-wizard-option-with-secondary' : ''; ?>">
148 <a href="#pods-wizard-extend" data-opt="extend">
149 <div>
150 <h2><?php esc_html_e( 'Extend an existing Content Type', 'pods' ); ?></h2>
151 <p><?php echo wp_kses_post( __( '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>
152 </div>
153 <span>&#10095;</span>
154 </a>
155
156 <?php if ( ! empty( $quick_actions ) ) : ?>
157 <div id="pods-wizard-quick-actions"
158 <?php echo $submit_from_linked ? 'class="hidden"' : ''; ?>>
159 <h2 class="pods-wizard-one-click-actions-heading"><?php esc_html_e( 'One-Click Extend', 'pods' ); ?></h2>
160 <ul class="pods-wizard-one-click-actions">
161 <?php foreach ( $quick_actions as $quick_action_key => $quick_action ) : ?>
162 <li class="pods-wizard-one-click-action">
163 <a href="#<?php echo esc_attr( sanitize_title( $quick_action['create_extend'] . '-' . $quick_action['type'] . '-' . $quick_action['object'] ) ); ?>"
164 data-create-extend="<?php echo esc_attr( $quick_action['create_extend'] ); ?>"
165 data-object="<?php echo esc_attr( $quick_action['object'] ); ?>"
166 data-type="<?php echo esc_attr( $quick_action['type'] ); ?>"
167 class="pods-wizard-quick-action"
168 id="pods-wizard-quick-action-<?php echo esc_attr( $quick_action_key ); ?>"
169 >
170 <?php echo esc_html( $quick_action['label'] ); ?>
171 </a>
172 </li>
173 <?php endforeach; ?>
174 </ul>
175 </div>
176 <?php endif; ?>
177 </div>
178 </div>
179 </div>
180 </div>
181 <div id="pods-wizard-panel-2" class="pods-wizard-panel">
182 <div class="pods-wizard-option-content" id="pods-wizard-create">
183 <div class="pods-wizard-content">
184 <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>
185 </div>
186 <div class="stuffbox">
187 <h3><label for="link_name"><?php esc_html_e( 'Create a New Content Type', 'pods' ); ?></label>
188 </h3>
189
190 <div class="inside pods-manage-field pods-dependency">
191 <div class="pods-field__container">
192 <?php
193 echo PodsForm::label( 'create_pod_type', __( 'Content Type', 'pods' ), [
194 __( '<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' ),
195 'https://docs.pods.io/creating-editing-pods/compare-content-types/',
196 ] );
197
198 $data = [
199 'post_type' => __( 'Custom Post Type (like Posts or Pages)', 'pods' ),
200 'taxonomy' => __( 'Custom Taxonomy (like Categories or Tags)', 'pods' ),
201 'settings' => __( 'Custom Settings Page', 'pods' ),
202 'pod' => ''
203 // component will fill this in if it's enabled (this exists for placement)
204 ];
205
206 $data = apply_filters( 'pods_admin_setup_add_create_pod_type', $data );
207
208 if ( empty( $data['pod'] ) ) {
209 unset( $data['pod'] );
210 }
211
212 if ( pods_is_types_only() ) {
213 unset( $data['settings'], $data['pod'] );
214 }
215
216 echo PodsForm::field( 'create_pod_type', pods_v( 'create_pod_type', 'post', 'post_type', true ), 'pick', [
217 'data' => $data,
218 'pick_format_single' => 'dropdown',
219 'dependency' => true,
220 ] );
221 ?>
222 </div>
223 <div class="pods-field__container">
224 <?php
225 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' ) );
226 echo PodsForm::field( 'create_label_singular', pods_v( 'create_label_singular', 'post' ), 'text', [
227 'class' => 'pods-validate pods-validate-required',
228 'text_max_length' => 30,
229 'excludes-on' => [
230 'create_pod_type' => 'settings',
231 ],
232 ] );
233 ?>
234 </div>
235 <div class="pods-field__container">
236 <?php
237 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' ) );
238 echo PodsForm::field( 'create_label_plural', pods_v( 'create_label_plural', 'post' ), 'text', [
239 'text_max_length' => 30,
240 'excludes-on' => [
241 'create_pod_type' => 'settings',
242 ],
243 ] );
244 ?>
245 </div>
246 <div class="pods-field__container">
247 <?php
248 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' ) );
249 echo PodsForm::field( 'create_label_title', pods_v( 'create_label_title', 'post' ), 'text', [
250 'class' => 'pods-validate pods-validate-required',
251 'text_max_length' => 30,
252 'depends-on' => [
253 'create_pod_type' => 'settings',
254 ],
255 ] );
256 ?>
257 </div>
258 <div class="pods-field__container">
259 <?php
260 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' ) );
261 echo PodsForm::field( 'create_label_menu', pods_v( 'create_label_menu', 'post' ), 'text', [
262 'text_max_length' => 30,
263 'depends-on' => [
264 'create_pod_type' => 'settings',
265 ],
266 ] );
267 ?>
268 </div>
269 <div class="pods-field__container">
270 <?php
271 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' ) );
272
273 $data = [
274 'settings' => __( 'Add to Settings menu', 'pods' ),
275 'appearances' => __( 'Add to Appearances menu', 'pods' ),
276 'top' => __( 'Make a new menu item below Settings', 'pods' ),
277 ];
278
279 echo PodsForm::field( 'create_menu_location', pods_v( 'create_menu_location', 'post' ), 'pick', [
280 'data' => $data,
281 'pick_format_single' => 'dropdown',
282 'depends-on' => [
283 'create_pod_type' => 'settings',
284 ],
285 ] );
286 ?>
287 </div>
288
289 <div class='pods-field__container'>
290 <?php
291 echo PodsForm::label( 'create_publicly_queryable', __( 'Content Privacy', 'pods' ), __( 'This option will make the content type publicly queryable.', 'pods' ) );
292 echo PodsForm::field( 'create_publicly_queryable', pods_v( 'create_publicly_queryable', 'post' ), 'boolean', [
293 'default' => 0,
294 'boolean_yes_label' => __( 'Yes, make this content available for Dynamic Features in Pods and WordPress', 'pods' ),
295 'depends-on' => [
296 'create_pod_type' => [
297 'post_type',
298 'taxonomy',
299 ],
300 ],
301 ] );
302 ?>
303 </div>
304
305 <p>
306 <a href="#pods-advanced" class="pods-advanced-toggle"><?php esc_html_e( 'Advanced', 'pods' ); ?> +</a>
307 </p>
308
309 <div class="pods-advanced">
310 <div class="pods-field__container">
311 <?php
312 global $wpdb;
313 $max_length_name = 64;
314 $max_length_name -= 10; // Allow for WP Multisite or prefix changes in the future
315 $max_length_name -= strlen( $wpdb->prefix . 'pods_' );
316
317 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 programmatically reference this object throughout your theme, WordPress, and other PHP.', 'pods' ) );
318 echo PodsForm::field( 'create_name', pods_v( 'create_name', 'post' ), 'slug', [
319 'attributes' => [
320 'maxlength' => $max_length_name,
321 'size' => 25,
322 ],
323 'excludes-on' => [
324 'create_pod_type' => 'settings',
325 ],
326 ] );
327 ?>
328 </div>
329 <div class="pods-field__container">
330 <?php
331 global $wpdb;
332 $max_length_name = 64;
333 $max_length_name -= 10; // Allow for WP Multisite or prefix changes in the future
334 $max_length_name -= strlen( $wpdb->prefix . 'pods_' );
335
336 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 programmatically reference this object throughout your theme, WordPress, and other PHP.', 'pods' ) );
337 echo PodsForm::field( 'create_setting_name', pods_v( 'create_setting_name', 'post' ), 'slug', [
338 'attributes' => [
339 'maxlength' => $max_length_name,
340 'size' => 25,
341 ],
342 'depends-on' => [
343 'create_pod_type' => 'settings',
344 ],
345 ] );
346 ?>
347 </div>
348 <div class="pods-field__container">
349 <?php
350 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' ) );
351 echo PodsForm::field( 'create_rest_api', pods_v( 'create_block_editor', 'post' ), 'boolean', [
352 'default' => 1,
353 'depends-on' => [
354 'create_pod_type' => [
355 'post_type',
356 'taxonomy',
357 ],
358 ],
359 ] );
360 ?>
361 </div>
362
363 <?php
364 if ( ! pods_tableless() && apply_filters( 'pods_admin_setup_add_create_storage', false ) ) {
365 ?>
366 <div class="pods-field__container">
367 <?php
368 echo PodsForm::label( 'create_storage', __( 'Storage Type', 'pods' ), [
369 __( '<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' ),
370 'https://docs.pods.io/creating-editing-pods/meta-vs-table-storage/',
371 ] );
372
373 $data = [
374 'meta' => __( 'Meta Based (WP Default)', 'pods' ),
375 'table' => __( 'Table Based', 'pods' ),
376 ];
377
378 echo PodsForm::field( 'create_storage', pods_v( 'create_storage', 'post' ), 'pick', [
379 'data' => $data,
380 'pick_format_single' => 'dropdown',
381 'depends-on' => [
382 'create_pod_type' => [
383 'post_type',
384 'taxonomy',
385 ],
386 ],
387 ] );
388 ?>
389 </div>
390 <?php
391 }
392 ?>
393 </div>
394 </div>
395 </div>
396 </div>
397 <div class="pods-wizard-option-content" id="pods-wizard-extend">
398 <div class="pods-wizard-content">
399 <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>
400 </div>
401 <div class="stuffbox">
402 <h3>
403 <label for="link_name"><?php esc_html_e( 'Extend an Existing Content Type', 'pods' ); ?></label>
404 </h3>
405
406 <div class="inside pods-manage-field pods-dependency">
407
408 <div class="pods-field__container">
409 <?php
410 echo PodsForm::label( 'extend_pod_type', __( 'Content Type', 'pods' ), [
411 __( '<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' ),
412 'https://docs.pods.io/creating-editing-pods/compare-content-types/',
413 ] );
414
415 $data = [
416 'post_type' => __( 'Post Types (Posts, Pages, etc..)', 'pods' ),
417 'taxonomy' => __( 'Taxonomies (Categories, Tags, etc..)', 'pods' ),
418 'media' => __( 'Media', 'pods' ),
419 'user' => __( 'Users', 'pods' ),
420 'comment' => __( 'Comments', 'pods' ),
421 ];
422
423 if ( isset( $all_pods['media'] ) && 'media' == $all_pods['media']['type'] ) {
424 unset( $data['media'] );
425 }
426
427 if ( isset( $all_pods['user'] ) && 'user' == $all_pods['user']['type'] ) {
428 unset( $data['user'] );
429 }
430
431 if ( isset( $all_pods['comment'] ) && 'comment' == $all_pods['comment']['type'] ) {
432 unset( $data['comment'] );
433 }
434
435 $data = apply_filters( 'pods_admin_setup_add_extend_pod_type', $data );
436
437 echo PodsForm::field( 'extend_pod_type', pods_v( 'extend_pod_type', 'post', 'post_type', true ), 'pick', [
438 'data' => $data,
439 'pick_format_single' => 'dropdown',
440 'dependency' => true,
441 ] );
442 ?>
443 </div>
444 <div class="pods-field__container">
445 <?php
446 $post_types = get_post_types();
447
448 foreach ( $post_types as $post_type => $label ) {
449 if ( empty( $post_type ) || isset( $ignore[ $post_type ] ) || 0 === strpos( $post_type, '_pods_' ) || ! $pods_meta->is_type_covered( 'post_type', $post_type ) ) {
450 // Post type is ignored
451 unset( $post_types[ $post_type ] );
452
453 continue;
454 } elseif ( isset( $all_pods[ $post_type ] ) && 'post_type' === $all_pods[ $post_type ]['type'] ) {
455 unset( $post_types[ $post_type ] );
456
457 continue;
458 }
459
460 $post_type = get_post_type_object( $post_type );
461 $post_types[ $post_type->name ] = $post_type->label . ' (' . $post_type->name . ')';
462 }
463
464 /**
465 * Allow filtering the list of post types that can be extended by Pods.
466 *
467 * @since 2.9.17
468 *
469 * @param array<string,string> $post_types The list of post types.
470 */
471 $post_types = apply_filters( 'pods_admin_setup_add_extend_post_types', $post_types );
472
473 echo PodsForm::label( 'extend_post_type', __( 'Post Type', 'pods' ), [
474 __( '<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' ),
475 'http://codex.wordpress.org/Post_Types',
476 ] );
477 echo PodsForm::field( 'extend_post_type', pods_v( 'extend_post_type', 'post' ), 'pick', [
478 'data' => $post_types,
479 'pick_format_single' => 'dropdown',
480 'depends-on' => [
481 'extend_pod_type' => 'post_type',
482 ],
483 ] );
484 ?>
485 </div>
486 <div class="pods-field__container">
487 <?php
488 $taxonomies = get_taxonomies();
489
490 foreach ( $taxonomies as $taxonomy => $label ) {
491 if ( empty( $taxonomy ) || isset( $ignore[ $taxonomy ] ) || 0 === strpos( $taxonomy, '_pods_' ) || ! $pods_meta->is_type_covered( 'taxonomy', $taxonomy ) ) {
492 // Taxonomy is ignored
493 unset( $taxonomies[ $taxonomy ] );
494
495 continue;
496 } elseif ( isset( $all_pods[ $taxonomy ] ) && 'taxonomy' == $all_pods[ $taxonomy ]['type'] ) {
497 unset( $taxonomies[ $taxonomy ] );
498 continue;
499 }
500
501 $taxonomy = get_taxonomy( $taxonomy );
502 $taxonomies[ $taxonomy->name ] = $taxonomy->label . ' (' . $taxonomy->name . ')';
503 }
504
505 /**
506 * Allow filtering the list of taxonomies that can be extended by Pods.
507 *
508 * @since 2.9.17
509 *
510 * @param array<string,string> $taxonomies The list of taxonomies.
511 */
512 $taxonomies = apply_filters( 'pods_admin_setup_add_extend_taxonomies', $taxonomies );
513
514 echo PodsForm::label( 'extend_taxonomy', __( 'Taxonomy', 'pods' ), [
515 __( '<h3>Taxonomies</h3> A taxonomy is a way to group Post Types.', 'pods' ),
516 'http://codex.wordpress.org/Taxonomies',
517 ] );
518 echo PodsForm::field( 'extend_taxonomy', pods_v( 'extend_taxonomy', 'post' ), 'pick', [
519 'data' => $taxonomies,
520 'pick_format_single' => 'dropdown',
521 'depends-on' => [
522 'extend_pod_type' => 'taxonomy',
523 ],
524 ] );
525 ?>
526 </div>
527
528 <?php
529 if ( ! pods_tableless() && apply_filters( 'pods_admin_setup_add_extend_storage', false ) ) {
530 ?>
531 <p>
532 <a href="#pods-advanced" class="pods-advanced-toggle"><?php esc_html_e( 'Advanced', 'pods' ); ?> +</a>
533 </p>
534
535 <div class="pods-advanced">
536 <div class="pods-field__container">
537 <?php
538 echo PodsForm::label( 'extend_storage', __( 'Storage Type', 'pods' ), [
539 __( '<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' ),
540 'https://docs.pods.io/creating-editing-pods/meta-vs-table-storage/',
541 ] );
542
543 $data = [
544 'meta' => __( 'Meta Based (WP Default)', 'pods' ),
545 'table' => __( 'Table Based', 'pods' ),
546 ];
547
548 echo PodsForm::field( 'extend_storage', pods_v( 'extend_storage', 'post' ), 'pick', [
549 'data' => $data,
550 'pick_format_single' => 'dropdown',
551 'depends-on' => [
552 'extend_pod_type' => [
553 'post_type',
554 'taxonomy',
555 'media',
556 'user',
557 'comment',
558 ],
559 ],
560 ] );
561 ?>
562 </div>
563 </div>
564 <?php
565 }
566 ?>
567 </div>
568 </div>
569 </div>
570
571 <div id="pods-wizard-quick-actions-saving-in-progress"
572 <?php echo ! $submit_from_linked ? 'class="hidden"' : ''; ?>>
573 <p>
574 <span class="pods-dfv-field__loading-indicator" role="progressbar"></span>
575 <?php esc_html_e( 'Setting up your Extended Pod', 'pods' ); ?>
576 </p>
577 </div>
578 </div>
579
580 <div id="pods-wizard-actions" class="pods-wizard-button-interface">
581 <div id="pods-wizard-toolbar">
582 <button id="pods-wizard-start" class="button button-secondary"><?php esc_html_e( 'Start Over', 'pods' ); ?></button>
583 <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>
584 </div>
585 <div id="pods-wizard-finished">
586
587 </div>
588 </div>
589 </div>
590 </div>
591 </div>
592 </form>
593 </div>
594 <script type="text/javascript">
595 var pods_admin_submit_callback = function ( id ) {
596 id = parseInt( id );
597
598 if ( !isNaN( id ) ) {
599 document.location = 'admin.php?page=pods&action=edit&id=' + id + '&do=create';
600 }
601 else {
602 document.location = 'admin.php?page=pods&do=create';
603 }
604 };
605
606 var pods_admin_submit_error_callback = function ( err_msg ) {
607 alert( 'Error: ' + err_msg );
608 if ( window.console ) console.log( err_msg );
609
610 jQuery( '#pods-wizard-quick-actions-saving-in-progress' ).addClass('hidden').hide();
611 jQuery( '#pods-wizard-start' ).click();
612 jQuery( '#pods-wizard-next' ).removeClass('hidden').show();
613 };
614
615 var pods_admin_option_select_callback = function ( $opt ) {
616 jQuery( '#pods_create_extend' ).val( $opt.data( 'opt' ) );
617 };
618
619 jQuery( function ( $ ) {
620 var $document = $( document );
621
622 $document.Pods( 'validate' );
623 $document.Pods( 'submit' );
624 $document.Pods( 'wizard' );
625 $document.Pods( 'advanced' );
626 $document.Pods( 'confirm' );
627 $document.Pods( 'sluggable' );
628
629 const $quick_actions = $( '.pods-wizard-quick-action' );
630
631 if ( $quick_actions[0] ) {
632 $quick_actions.on( 'click', function( e ) {
633 e.preventDefault();
634
635 const $action = $( this );
636 const createExtend = $action.data( 'create-extend' );
637 const objectName = $action.data( 'object' );
638 const objectType = $action.data( 'type' );
639
640 jQuery( '#pods_create_extend' ).val( createExtend );
641 jQuery( '#pods-form-ui-' + createExtend + '-pod-type' ).val( objectType );
642 jQuery( '#pods-form-ui-' + createExtend + '-' + objectType.replace( '_', '-' ) ).val( objectName );
643
644 jQuery( '#pods-wizard-heading li' ).removeClass().addClass('pods-wizard-menu-complete');
645 jQuery( '#pods-wizard-next' ).addClass('hidden').hide();
646 jQuery( '#pods-wizard-quick-actions-saving-in-progress' ).removeClass('hidden').show();
647
648 $action.closest( 'form' ).submit();
649 } );
650
651 <?php if ( $submit_from_linked ) : ?>
652 jQuery( '#pods-wizard-quick-action-<?php echo esc_attr( $submit_from_linked ); ?>' ).click();
653
654 $quick_actions.off( 'click' );
655 <?php endif; ?>
656 }
657 } );
658 </script>
659