PluginProbe ʕ •ᴥ•ʔ
Pods – Custom Content Types and Fields / 2.7.31.4
Pods – Custom Content Types and Fields v2.7.31.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 / form.php
pods / ui / admin Last commit date
upgrade 3 days ago widgets 3 days ago components-admin.php 3 days ago field-option.php 3 days ago form-settings.php 3 days ago form.php 3 days ago help.php 3 days ago postbox-header.php 3 days ago settings-reset.php 3 days ago settings-settings.php 3 days ago settings-tools.php 3 days ago settings.php 3 days ago setup-add.php 3 days ago setup-edit-field-fluid.php 3 days ago setup-edit-field.php 3 days ago setup-edit.php 3 days ago shortcode.php 3 days ago view.php 3 days ago
form.php
680 lines
1 <?php
2 wp_enqueue_script( 'pods' );
3 wp_enqueue_style( 'pods-form' );
4
5 if ( empty( $fields ) || ! is_array( $fields ) ) {
6 $fields = $obj->pod->fields;
7 }
8
9 if ( ! isset( $duplicate ) ) {
10 $duplicate = false;
11 } else {
12 $duplicate = (boolean) $duplicate;
13 }
14
15 $groups = PodsInit::$meta->groups_get( $pod->pod_data['type'], $pod->pod_data['name'], $fields );
16
17 $pod_name = $pod->pod_data['name'];
18 $pod_options = $pod->pod_data['options'];
19 $pod_options = apply_filters( "pods_advanced_content_type_pod_data_{$pod_name}", $pod_options, $pod->pod_data['name'] );
20 $pod_options = apply_filters( 'pods_advanced_content_type_pod_data', $pod_options, $pod->pod_data['name'] );
21
22 $group_fields = array();
23 $submittable_fields = array();
24
25 foreach ( $groups as $g => $group ) {
26 // unset fields
27 foreach ( $group['fields'] as $k => $field ) {
28 if ( in_array( $field['name'], array( 'created', 'modified' ), true ) ) {
29 unset( $group['fields'][ $k ] );
30
31 continue;
32 } elseif ( false === PodsForm::permission( $field['type'], $field['name'], $field['options'], $group['fields'], $pod, $pod->id() ) ) {
33 if ( pods_v_sanitized( 'hidden', $field['options'], false ) ) {
34 $group['fields'][ $k ]['type'] = 'hidden';
35 } elseif ( pods_v_sanitized( 'read_only', $field['options'], false ) ) {
36 $group['fields'][ $k ]['readonly'] = true;
37 } else {
38 unset( $group['fields'][ $k ] );
39
40 continue;
41 }
42 } elseif ( ! pods_has_permissions( $field['options'] ) ) {
43 if ( pods_v_sanitized( 'hidden', $field['options'], false ) ) {
44 $group['fields'][ $k ]['type'] = 'hidden';
45 } elseif ( pods_v_sanitized( 'read_only', $field['options'], false ) ) {
46 $group['fields'][ $k ]['readonly'] = true;
47 }
48 }//end if
49
50 if ( ! pods_v_sanitized( 'readonly', $field, false ) ) {
51 $submittable_fields[ $field['name'] ] = $group['fields'][ $k ];
52 }
53
54 $group_fields[ $field['name'] ] = $group['fields'][ $k ];
55 }//end foreach
56 $groups[ $g ] = $group;
57 }//end foreach
58
59 if ( ! isset( $thank_you_alt ) ) {
60 $thank_you_alt = $thank_you;
61 }
62
63 $uri_hash = wp_create_nonce( 'pods_uri_' . $_SERVER['REQUEST_URI'] );
64 $field_hash = wp_create_nonce( 'pods_fields_' . implode( ',', array_keys( $submittable_fields ) ) );
65
66 $uid = pods_session_id();
67
68 if ( is_user_logged_in() ) {
69 $uid = 'user_' . get_current_user_id();
70 }
71
72 $nonce = wp_create_nonce( 'pods_form_' . $pod->pod . '_' . $uid . '_' . ( $duplicate ? 0 : $pod->id() ) . '_' . $uri_hash . '_' . $field_hash );
73
74 if ( isset( $_POST['_pods_nonce'] ) ) {
75 $action = __( 'saved', 'pods' );
76
77 if ( 'create' == pods_v( 'do', 'post', 'save' ) ) {
78 $action = __( 'created', 'pods' );
79 } elseif ( 'duplicate' == pods_v( 'do', 'get', 'save' ) ) {
80 $action = __( 'duplicated', 'pods' );
81 }
82
83 try {
84 $params = pods_unslash( (array) $_POST );
85 $id = $pod->api->process_form( $params, $pod, $submittable_fields, $thank_you );
86
87 $message = sprintf( __( '<strong>Success!</strong> %1$s %2$s successfully.', 'pods' ), $obj->item, $action );
88
89 if ( 0 < strlen( pods_v_sanitized( 'detail_url', $pod_options ) ) ) {
90 $message .= ' <a target="_blank" rel="noopener noreferrer" href="' . $pod->field( 'detail_url' ) . '">' . sprintf( __( 'View %s', 'pods' ), $obj->item ) . '</a>';
91 }
92
93 $error = sprintf( __( '<strong>Error:</strong> %1$s %2$s successfully.', 'pods' ), $obj->item, $action );
94
95 if ( 0 < $id ) {
96 echo $obj->message( $message );
97 } else {
98 echo $obj->error( $error );
99 }
100 } catch ( Exception $e ) {
101 echo $obj->error( $e->getMessage() );
102 }
103 } elseif ( isset( $_GET['do'] ) ) {
104 $action = __( 'saved', 'pods' );
105
106 if ( 'create' == pods_v( 'do', 'get', 'save' ) ) {
107 $action = __( 'created', 'pods' );
108 } elseif ( 'duplicate' == pods_v( 'do', 'get', 'save' ) ) {
109 $action = __( 'duplicated', 'pods' );
110 }
111
112 $message = sprintf( __( '<strong>Success!</strong> %1$s %2$s successfully.', 'pods' ), $obj->item, $action );
113
114 if ( 0 < strlen( pods_v_sanitized( 'detail_url', $pod_options ) ) ) {
115 $message .= ' <a target="_blank" rel="noopener noreferrer" href="' . $pod->field( 'detail_url' ) . '">' . sprintf( __( 'View %s', 'pods' ), $obj->item ) . '</a>';
116 }
117
118 $error = sprintf( __( '<strong>Error:</strong> %1$s not %2$s.', 'pods' ), $obj->item, $action );
119
120 if ( 0 < $pod->id() ) {
121 echo $obj->message( $message );
122 } else {
123 echo $obj->error( $error );
124 }
125 }//end if
126
127 if ( ! isset( $label ) ) {
128 $label = __( 'Save', 'pods' );
129 }
130
131 $do = 'create';
132
133 if ( 0 < $pod->id() ) {
134 if ( $duplicate ) {
135 $do = 'duplicate';
136 } else {
137 $do = 'save';
138 }
139 }
140 ?>
141
142 <form action="" method="post" class="pods-submittable pods-form pods-form-pod-<?php echo esc_attr( $pod->pod ); ?> pods-submittable-ajax">
143 <div class="pods-submittable-fields">
144 <?php
145 echo PodsForm::field( 'action', 'pods_admin', 'hidden' );
146 echo PodsForm::field( 'method', 'process_form', 'hidden' );
147 echo PodsForm::field( 'do', $do, 'hidden' );
148 echo PodsForm::field( '_pods_nonce', $nonce, 'hidden' );
149 echo PodsForm::field( '_pods_pod', $pod->pod, 'hidden' );
150 echo PodsForm::field( '_pods_id', ( $duplicate ? 0 : $pod->id() ), 'hidden' );
151 echo PodsForm::field( '_pods_uri', $uri_hash, 'hidden' );
152 echo PodsForm::field( '_pods_form', implode( ',', array_keys( $submittable_fields ) ), 'hidden' );
153 echo PodsForm::field( '_pods_location', $_SERVER['REQUEST_URI'], 'hidden' );
154
155 foreach ( $group_fields as $field ) {
156 if ( 'hidden' !== $field['type'] ) {
157 continue;
158 }
159
160 echo PodsForm::field(
161 'pods_field_' . $field['name'], $pod->field(
162 array(
163 'name' => $field['name'],
164 'in_form' => true,
165 )
166 ), 'hidden'
167 );
168 }
169
170 /**
171 * Action that runs before the meta boxes for an Advanced Content Type
172 *
173 * Occurs at the top of #poststuff
174 *
175 * @param Pods $pod Current Pods object.
176 * @param PodsUI $obj Current PodsUI object.
177 *
178 * @since 2.5.0
179 */
180 do_action( 'pods_meta_box_pre', $pod, $obj );
181 ?>
182 <div id="poststuff" class="poststuff metabox-holder has-right-sidebar"> <!-- class "has-right-sidebar" preps for a sidebar... always present? -->
183 <div id="side-info-column" class="inner-sidebar">
184 <?php
185 /**
186 * Action that runs before the sidebar of the editor for an Advanced Content Type
187 *
188 * Occurs at the top of #side-info-column
189 *
190 * @param Pods $pod Current Pods object.
191 * @param PodsUI $obj Current PodsUI object.
192 *
193 * @since 2.4.1
194 */
195 do_action( 'pods_act_editor_before_sidebar', $pod, $obj );
196 ?>
197 <div id="side-sortables" class="meta-box-sortables ui-sortable">
198 <!-- BEGIN PUBLISH DIV -->
199 <div id="submitdiv" class="postbox">
200 <?php PodsForm::render_postbox_header( pods_v( 'label_manage', $pod_options, __( 'Manage', 'pods' ) ) ); ?>
201
202 <div class="inside">
203 <div class="submitbox" id="submitpost">
204 <?php
205 if ( 0 < $pod->id() && ( isset( $pod->pod_data['fields']['created'] ) || isset( $pod->pod_data['fields']['modified'] ) || 0 < strlen( pods_v_sanitized( 'detail_url', $pod_options ) ) ) ) {
206 ?>
207 <div id="minor-publishing">
208 <?php
209 if ( 0 < strlen( pods_v_sanitized( 'detail_url', $pod_options ) ) ) {
210 ?>
211 <div id="minor-publishing-actions">
212 <div id="preview-action">
213 <a class="button" href="<?php echo esc_url( $pod->field( 'detail_url' ) ); ?>" target="_blank" rel="noopener noreferrer"><?php echo sprintf( __( 'View %s', 'pods' ), $obj->item ); ?></a>
214 </div>
215 <div class="clear"></div>
216 </div>
217 <?php
218 }
219
220 if ( isset( $pod->pod_data['fields']['created'] ) || isset( $pod->pod_data['fields']['modified'] ) ) {
221 ?>
222 <div id="misc-publishing-actions">
223 <?php
224 $datef = __( 'M j, Y @ G:i' );
225
226 if ( isset( $pod->pod_data['fields']['created'] ) ) {
227 $date = date_i18n( $datef, strtotime( $pod->field( 'created' ) ) );
228 ?>
229 <div class="misc-pub-section curtime">
230 <span id="timestamp"><?php _e( 'Created on', 'pods' ); ?>: <b><?php echo $date; ?></b></span>
231 </div>
232 <?php
233 }
234
235 if ( isset( $pod->pod_data['fields']['modified'] ) && $pod->display( 'created' ) != $pod->display( 'modified' ) ) {
236 $date = date_i18n( $datef, strtotime( $pod->field( 'modified' ) ) );
237 ?>
238 <div class="misc-pub-section curtime">
239 <span id="timestamp"><?php _e( 'Last Modified', 'pods' ); ?>: <b><?php echo $date; ?></b></span>
240 </div>
241 <?php
242 }
243 ?>
244
245 <?php
246 /**
247 * Action that runs after the misc publish actions area for an Advanced Content Type
248 *
249 * Occurs at the end of #misc-publishing-actions
250 *
251 * @param Pods $pod Current Pods object.
252 * @param PodsUI $obj Current PodsUI object.
253 *
254 * @since 2.5.0
255 */
256 do_action( 'pods_ui_form_misc_pub_actions', $pod, $obj );
257 ?>
258 </div>
259 <?php
260 }//end if
261 ?>
262 </div>
263 <!-- /#minor-publishing -->
264 <?php
265 }//end if
266 ?>
267
268 <div id="major-publishing-actions">
269 <?php
270 if ( pods_is_admin(
271 array(
272 'pods',
273 'pods_delete_' . $pod->pod,
274 )
275 ) && null !== $pod->id() && ! $duplicate && ! in_array( 'delete', (array) $obj->actions_disabled, true ) && ! in_array( 'delete', (array) $obj->actions_hidden, true ) ) {
276 $link = pods_query_arg(
277 array(
278 'action' => 'delete',
279 '_wpnonce' => wp_create_nonce( 'pods-ui-action-delete' ),
280 )
281 );
282 ?>
283 <div id="delete-action">
284 <a class="submitdelete deletion" href="<?php echo esc_url( $link ); ?>" onclick="return confirm('<?php _e( 'You are about to permanently delete this item. Choose CANCEL to stop, OK to delete.', 'pods' ); ?>');"><?php _e( 'Delete', 'pods' ); ?></a>
285 </div>
286 <!-- /#delete-action -->
287 <?php } ?>
288
289 <div id="publishing-action">
290 <img class="waiting" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
291 <input type="submit" name="publish" id="publish" class="button button-primary button-large" value="<?php echo esc_attr( $label ); ?>" accesskey="p" />
292 <?php
293 /**
294 * Action that runs after the publish button for an Advanced Content Type
295 *
296 * Occurs at the end of #publishing-action
297 *
298 * @param Pods $pod Current Pods object.
299 * @param PodsUI $obj Current PodsUI object.
300 *
301 * @since 2.5.0
302 */
303 do_action( 'pods_ui_form_submit_area', $pod, $obj );
304 ?>
305 </div>
306 <!-- /#publishing-action -->
307
308 <div class="clear"></div>
309 </div>
310
311 <?php
312 /**
313 * Action that runs after the publish area for an Advanced Content Type
314 *
315 * Occurs at the end of #submitpost
316 *
317 * @param Pods $pod Current Pods object.
318 * @param PodsUI $obj Current PodsUI object.
319 *
320 * @since 2.5.0
321 */
322 do_action( 'pods_ui_form_publish_area', $pod, $obj );
323 ?>
324 <!-- /#major-publishing-actions -->
325 </div>
326 <!-- /#submitpost -->
327 </div>
328 <!-- /.inside -->
329 </div>
330 <!-- /#submitdiv --><!-- END PUBLISH DIV --><!-- TODO: minor column fields -->
331 <?php
332 if ( pods_v( 'action' ) == 'edit' && ! $duplicate && ! in_array( 'navigate', (array) $obj->actions_disabled, true ) && ! in_array( 'navigate', (array) $obj->actions_hidden, true ) ) {
333 if ( ! isset( $singular_label ) ) {
334 $singular_label = ucwords( str_replace( '_', ' ', $pod->pod_data['name'] ) );
335 }
336
337 $singular_label = pods_v( 'label', $pod_options, $singular_label, null, true );
338 $singular_label = pods_v( 'label_singular', $pod_options, $singular_label, null, true );
339
340 $pod->params = $obj->get_params( null, 'manage' );
341
342 $prev_next = apply_filters( 'pods_ui_prev_next_ids', array(), $pod, $obj );
343
344 if ( empty( $prev_next ) ) {
345 $prev_next = array(
346 'prev' => $pod->prev_id(),
347 'next' => $pod->next_id(),
348 );
349 }
350
351 $prev = $prev_next['prev'];
352 $next = $prev_next['next'];
353
354 if ( 0 < $prev || 0 < $next ) {
355 ?>
356 <div id="navigatediv" class="postbox">
357 <?php
358 /**
359 * Action that runs before the post navagiation in the editor for an Advanced Content Type
360 *
361 * Occurs at the top of #navigatediv
362 *
363 * @param Pods $pod Current Pods object.
364 * @param PodsUI $obj Current PodsUI object.
365 *
366 * @since 2.4.1
367 */
368 do_action( 'pods_act_editor_before_navigation', $pod, $obj );
369
370 PodsForm::render_postbox_header( __( 'Navigate', 'pods' ) );
371 ?>
372 <div class="inside">
373 <div class="pods-admin" id="navigatebox">
374 <div id="navigation-actions">
375 <?php
376 if ( 0 < $prev ) {
377 ?>
378 <a class="previous-item" href="<?php echo esc_url( pods_query_arg( array( 'id' => $prev ), null, 'do' ) ); ?>">
379 <span>&laquo;</span>
380 <?php echo sprintf( __( 'Previous %s', 'pods' ), $singular_label ); ?>
381 </a>
382 <?php
383 }
384
385 if ( 0 < $next ) {
386 ?>
387 <a class="next-item" href="<?php echo esc_url( pods_query_arg( array( 'id' => $next ), null, 'do' ) ); ?>">
388 <?php echo sprintf( __( 'Next %s', 'pods' ), $singular_label ); ?>
389 <span>&raquo;</span> </a>
390 <?php
391 }
392 ?>
393
394 <div class="clear"></div>
395 </div>
396 <!-- /#navigation-actions -->
397 </div>
398 <!-- /#navigatebox -->
399 </div>
400 <!-- /.inside -->
401 <?php
402 /**
403 * Action that runs after the post navagiation in the editor for an Advanced Content Type
404 *
405 * Occurs at the bottom of #navigatediv
406 *
407 * @param Pods $pod Current Pods object.
408 * @param PodsUI $obj Current PodsUI object.
409 *
410 * @since 2.4.1
411 */
412 do_action( 'pods_act_editor_after_navigation', $pod, $obj );
413 ?>
414 </div> <!-- /#navigatediv -->
415 <?php
416 }//end if
417 }//end if
418 ?>
419 </div>
420 <!-- /#side-sortables -->
421 <?php
422 /**
423 * Action that runs after the sidebar of the editor for an Advanced Content Type
424 *
425 * Occurs at the bottom of #side-info-column
426 *
427 * @param Pods $pod Current Pods object.
428 * @param PodsUI $obj Current PodsUI object.
429 *
430 * @since 2.4.1
431 */
432 do_action( 'pods_act_editor_after_sidebar', $pod, $obj );
433 ?>
434 </div>
435 <!-- /#side-info-column -->
436
437 <div id="post-body">
438 <div id="post-body-content">
439 <?php
440 $more = false;
441
442 if ( $pod->pod_data['field_index'] != $pod->pod_data['field_id'] ) {
443 foreach ( $group_fields as $field ) {
444 if ( $pod->pod_data['field_index'] != $field['name'] || 'text' !== $field['type'] ) {
445 continue;
446 }
447
448 $more = true;
449 $extra = '';
450
451 $max_length = (int) pods_v_sanitized( 'maxlength', $field['options'], pods_v_sanitized( $field['type'] . '_max_length', $field['options'], 0 ), null, true );
452
453 if ( 0 < $max_length ) {
454 $extra .= ' maxlength="' . esc_attr( $max_length ) . '"';
455 }
456
457 /**
458 * Filter that lets you make the title field readonly
459 *
460 * @param Pods $pod Current Pods object.
461 * @param PodsUI $obj Current PodsUI object.
462 *
463 * @since 2.5.0
464 */
465 if ( pods_v( 'readonly', $field['options'], pods_v( 'readonly', $field, false ) ) || apply_filters( 'pods_ui_form_title_readonly', false, $pod, $obj ) ) {
466 ?>
467 <div id="titlediv">
468 <div id="titlewrap">
469 <h3><?php echo esc_html( $pod->index() ); ?></h3>
470 <input type="hidden" name="pods_field_<?php echo esc_attr( $pod->pod_data['field_index'] ); ?>" data-name-clean="pods-field-<?php echo esc_attr( $pod->pod_data['field_index'] ); ?>" id="title" size="30" tabindex="1" value="<?php echo esc_attr( htmlspecialchars( $pod->index() ) ); ?>" class="pods-form-ui-field-name-pods-field-<?php echo esc_attr( $pod->pod_data['field_index'] ); ?>" autocomplete="off"<?php echo $extra; ?> />
471 </div>
472 <!-- /#titlewrap -->
473 </div>
474 <!-- /#titlediv -->
475 <?php
476 } else {
477 ?>
478 <div id="titlediv">
479 <?php
480 /**
481 * Action that runs before the title field of the editor for an Advanced Content Type
482 *
483 * Occurs at the top of #titlediv
484 *
485 * @param Pods $pod Current Pods object.
486 * @param PodsUI $obj Current PodsUI object.
487 *
488 * @since 2.4.1
489 */
490 do_action( 'pods_act_editor_before_title', $pod, $obj );
491 ?>
492 <div id="titlewrap">
493 <label class="screen-reader-text" id="title-prompt-text" for="title"><?php echo apply_filters( 'pods_enter_name_here', __( 'Enter name here', 'pods' ), $pod, $fields ); ?></label>
494 <input type="text" name="pods_field_<?php echo esc_attr( $pod->pod_data['field_index'] ); ?>" data-name-clean="pods-field-<?php echo esc_attr( $pod->pod_data['field_index'] ); ?>" id="title" size="30" tabindex="1" value="<?php echo esc_attr( htmlspecialchars( $pod->index() ) ); ?>" class="pods-form-ui-field-name-pods-field-<?php echo esc_attr( $pod->pod_data['field_index'] ); ?>" autocomplete="off"<?php echo $extra; ?> />
495 <?php
496 /**
497 * Action that runs after the title field of the editor for an Advanced Content Type
498 *
499 * Occurs at the bottom of #titlediv
500 *
501 * @param Pods $pod Current Pods object.
502 * @param PodsUI $obj Current PodsUI object.
503 *
504 * @since 2.4.1
505 */
506 do_action( 'pods_act_editor_after_title', $pod, $obj );
507 ?>
508 </div>
509 <!-- /#titlewrap -->
510
511 <div class="inside">
512 <div id="edit-slug-box">
513 </div>
514 <!-- /#edit-slug-box -->
515 </div>
516 <!-- /.inside -->
517 </div>
518 <!-- /#titlediv -->
519 <?php
520 }//end if
521
522 unset( $group_fields[ $field['name'] ] );
523 }//end foreach
524 }//end if
525
526 if ( 0 < count( $groups ) ) {
527 if ( $more && 1 == count( $groups ) ) {
528 $first_group = current( $groups );
529
530 if ( 1 == count( $first_group['fields'] ) && isset( $first_group['fields'][ $pod->pod_data['field_index'] ] ) ) {
531 $groups = array();
532 }
533 }
534
535 if ( 0 < count( $groups ) ) {
536 ?>
537 <div id="normal-sortables" class="meta-box-sortables ui-sortable">
538 <?php
539 foreach ( $groups as $group ) {
540 if ( empty( $group['fields'] ) ) {
541 continue;
542 }
543
544 /**
545 * Action that runs before the main fields metabox in the editor for an Advanced Content Type
546 *
547 * Occurs at the top of #normal-sortables
548 *
549 * @param Pods $pod Current Pods object.
550 *
551 * @since 2.4.1
552 */
553 do_action( 'pods_act_editor_before_metabox', $pod );
554
555 if ( ! $more && 1 == count( $groups ) ) {
556 $title = __( 'Fields', 'pods' );
557 } else {
558 $title = $group['label'];
559 }
560
561 /** This filter is documented in classes/PodsMeta.php */
562 $title = apply_filters( 'pods_meta_default_box_title', $title, $pod, $fields, $pod->api->pod_data['type'], $pod->pod );
563 ?>
564 <div id="pods-meta-box-<?php echo esc_attr( sanitize_title( $group['label'] ) ); ?>" class="postbox">
565 <?php PodsForm::render_postbox_header( $title ); ?>
566
567 <div class="inside">
568 <?php
569 if ( false === apply_filters( 'pods_meta_box_override', false, $pod, $group, $obj ) ) {
570 ?>
571 <table class="form-table pods-metabox">
572 <?php
573 foreach ( $group['fields'] as $field ) {
574 if ( 'hidden' === $field['type'] || $more === $field['name'] || ! isset( $group_fields[ $field['name'] ] ) ) {
575 continue;
576 }
577 ?>
578 <tr class="form-field pods-field pods-field-input <?php echo esc_attr( 'pods-form-ui-row-type-' . $field['type'] . ' pods-form-ui-row-name-' . PodsForm::clean( $field['name'], true ) ); ?>">
579 <th scope="row" valign="top"><?php echo PodsForm::label( 'pods_field_' . $field['name'], $field['label'], $field['help'], $field ); ?></th>
580 <td>
581 <?php
582 echo PodsForm::field(
583 'pods_field_' . $field['name'], $pod->field(
584 array(
585 'name' => $field['name'],
586 'in_form' => true,
587 )
588 ), $field['type'], $field, $pod, $pod->id()
589 );
590 ?>
591 <?php echo PodsForm::comment( 'pods_field_' . $field['name'], $field['description'], $field ); ?>
592 </td>
593 </tr>
594 <?php
595 }//end foreach
596 ?>
597 </table>
598 <?php
599 }//end if
600 ?>
601 </div>
602 <!-- /.inside -->
603 </div>
604 <!-- /#pods-meta-box -->
605 <?php
606 }//end foreach
607
608 /**
609 * Action that runs after the main fields metabox in the editor for an Advanced Content Type
610 *
611 * Occurs at the bottom of #normal-sortables
612 *
613 * @param Pods $pod Current Pods object.
614 * @param PodsUI $obj Current PodsUI object.
615 *
616 * @since 2.4.1
617 */
618 do_action( 'pods_act_editor_after_metabox', $pod, $obj );
619 ?>
620 </div>
621 <!-- /#normal-sortables -->
622
623 <?php
624 }//end if
625 }//end if
626 ?>
627
628 <!-- <div id="advanced-sortables" class="meta-box-sortables ui-sortable"></div> -->
629 <!-- /#advanced-sortables -->
630
631 </div>
632 <!-- /#post-body-content -->
633
634 <br class="clear" />
635 </div>
636 <!-- /#post-body -->
637
638 <br class="clear" />
639 </div>
640 <!-- /#poststuff -->
641 </div>
642 </form>
643 <!-- /#pods-record -->
644
645 <script type="text/javascript">
646 if ( 'undefined' == typeof ajaxurl ) {
647 var ajaxurl = '<?php echo pods_slash( admin_url( 'admin-ajax.php' ) ); ?>';
648 }
649
650 jQuery( function ( $ ) {
651 $( document ).Pods( 'validate' );
652 $( document ).Pods( 'submit' );
653 $( document ).Pods( 'dependency' );
654 $( document ).Pods( 'confirm' );
655 $( document ).Pods( 'exit_confirm' );
656 } );
657
658 if ( 'undefined' == typeof pods_form_thank_you ) {
659 var pods_form_thank_you = null;
660 }
661
662 var pods_admin_submit_callback = function ( id ) {
663
664 id = parseInt( id, 10 );
665 var thank_you = '<?php echo esc_url_raw( $thank_you ); ?>';
666 var thank_you_alt = '<?php echo esc_url_raw( $thank_you_alt ); ?>';
667
668 if ( 'undefined' != typeof pods_form_thank_you && null !== pods_form_thank_you ) {
669 thank_you = pods_form_thank_you;
670 }
671
672 if ( isNaN( id ) ) {
673 document.location = thank_you_alt.replace( 'X_ID_X', String( 0 ) );
674 }
675 else {
676 document.location = thank_you.replace( 'X_ID_X', String( id ) );
677 }
678 }
679 </script>
680