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