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