/ui/admin/form.php

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