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 / 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
634 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 <p>
292 <a href="#pods-advanced" class="pods-advanced-toggle"><?php esc_html_e( 'Advanced', 'pods' ); ?> +</a>
293 </p>
294
295 <div class="pods-advanced">
296 <div class="pods-field__container">
297 <?php
298 global $wpdb;
299 $max_length_name = 64;
300 $max_length_name -= 10; // Allow for WP Multisite or prefix changes in the future
301 $max_length_name -= strlen( $wpdb->prefix . 'pods_' );
302
303 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' ) );
304 echo PodsForm::field( 'create_name', pods_v( 'create_name', 'post' ), 'slug', [
305 'attributes' => [
306 'maxlength' => $max_length_name,
307 'size' => 25,
308 ],
309 'excludes-on' => [
310 'create_pod_type' => 'settings',
311 ],
312 ] );
313 ?>
314 </div>
315 <div class="pods-field__container">
316 <?php
317 global $wpdb;
318 $max_length_name = 64;
319 $max_length_name -= 10; // Allow for WP Multisite or prefix changes in the future
320 $max_length_name -= strlen( $wpdb->prefix . 'pods_' );
321
322 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' ) );
323 echo PodsForm::field( 'create_setting_name', pods_v( 'create_setting_name', 'post' ), 'slug', [
324 'attributes' => [
325 'maxlength' => $max_length_name,
326 'size' => 25,
327 ],
328 'depends-on' => [
329 'create_pod_type' => 'settings',
330 ],
331 ] );
332 ?>
333 </div>
334 <div class="pods-field__container">
335 <?php
336 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' ) );
337 echo PodsForm::field( 'create_rest_api', pods_v( 'create_block_editor', 'post' ), 'boolean', [
338 'default' => 1,
339 'depends-on' => [
340 'create_pod_type' => [
341 'post_type',
342 'taxonomy',
343 ],
344 ],
345 ] );
346 ?>
347 </div>
348
349 <?php
350 if ( ! pods_tableless() && apply_filters( 'pods_admin_setup_add_create_storage', false ) ) {
351 ?>
352 <div class="pods-field__container">
353 <?php
354 echo PodsForm::label( 'create_storage', __( 'Storage Type', 'pods' ), [
355 __( '<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' ),
356 'https://docs.pods.io/creating-editing-pods/meta-vs-table-storage/',
357 ] );
358
359 $data = [
360 'meta' => __( 'Meta Based (WP Default)', 'pods' ),
361 'table' => __( 'Table Based', 'pods' ),
362 ];
363
364 echo PodsForm::field( 'create_storage', pods_v( 'create_storage', 'post' ), 'pick', [
365 'data' => $data,
366 'pick_format_single' => 'dropdown',
367 'depends-on' => [
368 'create_pod_type' => [
369 'post_type',
370 'taxonomy',
371 ],
372 ],
373 ] );
374 ?>
375 </div>
376 <?php
377 }
378 ?>
379 </div>
380 </div>
381 </div>
382 </div>
383 <div class="pods-wizard-option-content" id="pods-wizard-extend">
384 <div class="pods-wizard-content">
385 <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>
386 </div>
387 <div class="stuffbox">
388 <h3>
389 <label for="link_name"><?php esc_html_e( 'Extend an Existing Content Type', 'pods' ); ?></label>
390 </h3>
391
392 <div class="inside pods-manage-field pods-dependency">
393
394 <div class="pods-field__container">
395 <?php
396 echo PodsForm::label( 'extend_pod_type', __( 'Content Type', 'pods' ), [
397 __( '<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' ),
398 'https://docs.pods.io/creating-editing-pods/compare-content-types/',
399 ] );
400
401 $data = [
402 'post_type' => __( 'Post Types (Posts, Pages, etc..)', 'pods' ),
403 'taxonomy' => __( 'Taxonomies (Categories, Tags, etc..)', 'pods' ),
404 'media' => __( 'Media', 'pods' ),
405 'user' => __( 'Users', 'pods' ),
406 'comment' => __( 'Comments', 'pods' ),
407 ];
408
409 if ( isset( $all_pods['media'] ) && 'media' == $all_pods['media']['type'] ) {
410 unset( $data['media'] );
411 }
412
413 if ( isset( $all_pods['user'] ) && 'user' == $all_pods['user']['type'] ) {
414 unset( $data['user'] );
415 }
416
417 if ( isset( $all_pods['comment'] ) && 'comment' == $all_pods['comment']['type'] ) {
418 unset( $data['comment'] );
419 }
420
421 $data = apply_filters( 'pods_admin_setup_add_extend_pod_type', $data );
422
423 echo PodsForm::field( 'extend_pod_type', pods_v( 'extend_pod_type', 'post', 'post_type', true ), 'pick', [
424 'data' => $data,
425 'pick_format_single' => 'dropdown',
426 'dependency' => true,
427 ] );
428 ?>
429 </div>
430 <div class="pods-field__container">
431 <?php
432 $post_types = get_post_types();
433
434 foreach ( $post_types as $post_type => $label ) {
435 if ( empty( $post_type ) || isset( $ignore[ $post_type ] ) || 0 === strpos( $post_type, '_pods_' ) || ! $pods_meta->is_type_covered( 'post_type', $post_type ) ) {
436 // Post type is ignored
437 unset( $post_types[ $post_type ] );
438
439 continue;
440 } elseif ( isset( $all_pods[ $post_type ] ) && 'post_type' === $all_pods[ $post_type ]['type'] ) {
441 unset( $post_types[ $post_type ] );
442
443 continue;
444 }
445
446 $post_type = get_post_type_object( $post_type );
447 $post_types[ $post_type->name ] = $post_type->label . ' (' . $post_type->name . ')';
448 }
449
450 /**
451 * Allow filtering the list of post types that can be extended by Pods.
452 *
453 * @since 2.9.17
454 *
455 * @param array<string,string> $post_types The list of post types.
456 */
457 $post_types = apply_filters( 'pods_admin_setup_add_extend_post_types', $post_types );
458
459 echo PodsForm::label( 'extend_post_type', __( 'Post Type', 'pods' ), [
460 __( '<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' ),
461 'http://codex.wordpress.org/Post_Types',
462 ] );
463 echo PodsForm::field( 'extend_post_type', pods_v( 'extend_post_type', 'post' ), 'pick', [
464 'data' => $post_types,
465 'pick_format_single' => 'dropdown',
466 'depends-on' => [
467 'extend_pod_type' => 'post_type',
468 ],
469 ] );
470 ?>
471 </div>
472 <div class="pods-field__container">
473 <?php
474 $taxonomies = get_taxonomies();
475
476 foreach ( $taxonomies as $taxonomy => $label ) {
477 if ( empty( $taxonomy ) || isset( $ignore[ $taxonomy ] ) || 0 === strpos( $taxonomy, '_pods_' ) || ! $pods_meta->is_type_covered( 'taxonomy', $taxonomy ) ) {
478 // Taxonomy is ignored
479 unset( $taxonomies[ $taxonomy ] );
480
481 continue;
482 } elseif ( isset( $all_pods[ $taxonomy ] ) && 'taxonomy' == $all_pods[ $taxonomy ]['type'] ) {
483 unset( $taxonomies[ $taxonomy ] );
484 continue;
485 }
486
487 $taxonomy = get_taxonomy( $taxonomy );
488 $taxonomies[ $taxonomy->name ] = $taxonomy->label . ' (' . $taxonomy->name . ')';
489 }
490
491 /**
492 * Allow filtering the list of taxonomies that can be extended by Pods.
493 *
494 * @since 2.9.17
495 *
496 * @param array<string,string> $taxonomies The list of taxonomies.
497 */
498 $taxonomies = apply_filters( 'pods_admin_setup_add_extend_taxonomies', $taxonomies );
499
500 echo PodsForm::label( 'extend_taxonomy', __( 'Taxonomy', 'pods' ), [
501 __( '<h3>Taxonomies</h3> A taxonomy is a way to group Post Types.', 'pods' ),
502 'http://codex.wordpress.org/Taxonomies',
503 ] );
504 echo PodsForm::field( 'extend_taxonomy', pods_v( 'extend_taxonomy', 'post' ), 'pick', [
505 'data' => $taxonomies,
506 'pick_format_single' => 'dropdown',
507 'depends-on' => [
508 'extend_pod_type' => 'taxonomy',
509 ],
510 ] );
511 ?>
512 </div>
513
514 <?php
515 if ( ! pods_tableless() && apply_filters( 'pods_admin_setup_add_extend_storage', false ) ) {
516 ?>
517 <p>
518 <a href="#pods-advanced" class="pods-advanced-toggle"><?php esc_html_e( 'Advanced', 'pods' ); ?> +</a>
519 </p>
520
521 <div class="pods-advanced">
522 <div class="pods-field__container">
523 <?php
524 echo PodsForm::label( 'extend_storage', __( 'Storage Type', 'pods' ), [
525 __( '<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' ),
526 'https://docs.pods.io/creating-editing-pods/meta-vs-table-storage/',
527 ] );
528
529 $data = [
530 'meta' => __( 'Meta Based (WP Default)', 'pods' ),
531 'table' => __( 'Table Based', 'pods' ),
532 ];
533
534 echo PodsForm::field( 'extend_storage', pods_v( 'extend_storage', 'post' ), 'pick', [
535 'data' => $data,
536 'pick_format_single' => 'dropdown',
537 'depends-on' => [
538 'extend_pod_type' => [
539 'post_type',
540 'taxonomy',
541 'media',
542 'user',
543 'comment',
544 ],
545 ],
546 ] );
547 ?>
548 </div>
549 </div>
550 <?php
551 }
552 ?>
553 </div>
554 </div>
555 </div>
556 </div>
557
558 <div id="pods-wizard-actions" class="pods-wizard-button-interface">
559 <div id="pods-wizard-toolbar">
560 <button id="pods-wizard-start" class="button button-secondary"><?php esc_html_e( 'Start Over', 'pods' ); ?></button>
561 <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>
562 </div>
563 <div id="pods-wizard-finished">
564
565 </div>
566 </div>
567 </div>
568 </div>
569 </div>
570 </form>
571 </div>
572 <script type="text/javascript">
573 var pods_admin_submit_callback = function ( id ) {
574 id = parseInt( id );
575
576 if ( !isNaN( id ) ) {
577 document.location = 'admin.php?page=pods&action=edit&id=' + id + '&do=create';
578 }
579 else {
580 document.location = 'admin.php?page=pods&do=create';
581 }
582 };
583
584 var pods_admin_submit_error_callback = function ( err_msg ) {
585 alert( 'Error: ' + err_msg );
586 if ( window.console ) console.log( err_msg );
587
588 jQuery( '#pods-wizard-quick-actions-saving-in-progress' ).hide();
589 };
590
591 var pods_admin_option_select_callback = function ( $opt ) {
592 jQuery( '#pods_create_extend' ).val( $opt.data( 'opt' ) );
593 };
594
595 jQuery( function ( $ ) {
596 var $document = $( document );
597
598 $document.Pods( 'validate' );
599 $document.Pods( 'submit' );
600 $document.Pods( 'wizard' );
601 $document.Pods( 'advanced' );
602 $document.Pods( 'confirm' );
603 $document.Pods( 'sluggable' );
604
605 const $quick_actions = $( '.pods-wizard-quick-action' );
606
607 if ( $quick_actions[0] ) {
608 $quick_actions.on( 'click', function( e ) {
609 e.preventDefault();
610
611 const $action = $( this );
612 const createExtend = $action.data( 'create-extend' );
613 const objectName = $action.data( 'object' );
614 const objectType = $action.data( 'type' );
615
616 jQuery( '#pods_create_extend' ).val( createExtend );
617 jQuery( '#pods-form-ui-' + createExtend + '-pod-type' ).val( objectType );
618 jQuery( '#pods-form-ui-' + createExtend + '-' + objectType.replace( '_', '-' ) ).val( objectName );
619
620 $action.closest( 'form' ).submit();
621 } );
622
623 <?php if ( $submit_from_linked ) : ?>
624 jQuery( '#pods-wizard-quick-action-<?php echo esc_attr( $submit_from_linked ); ?>' ).click();
625
626 $quick_actions.off( 'click' );
627
628 jQuery( '#pods-wizard-quick-actions' ).hide();
629 jQuery( '#pods-wizard-quick-actions-saving-in-progress' ).show();
630 <?php endif; ?>
631 }
632 } );
633 </script>
634