PluginProbe ʕ •ᴥ•ʔ
Pods – Custom Content Types and Fields / 3.3.2
Pods – Custom Content Types and Fields v3.3.2
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 / components / Migrate-CPTUI / ui / wizard.php
pods / components / Migrate-CPTUI / ui Last commit date
wizard.php 1 year ago
wizard.php
230 lines
1 <div class="wrap pods-admin">
2 <div id="icon-pods" class="icon32"><br /></div>
3
4 <form action="" method="post" class="pods-submittable">
5 <div class="pods-submittable-fields">
6 <?php echo PodsForm::field( 'action', 'pods_admin_components', 'hidden' ); ?>
7 <?php echo PodsForm::field( 'component', $component, 'hidden' ); ?>
8 <?php echo PodsForm::field( 'method', $method, 'hidden' ); ?>
9 <?php echo PodsForm::field( '_wpnonce', wp_create_nonce( 'pods-component-' . $component . '-' . $method ), 'hidden' ); ?>
10 <?php echo PodsForm::field( 'cleanup', 0, 'hidden', array( 'attributes' => array( 'id' => 'pods_cleanup' ) ) ); ?>
11
12 <h2 class="italicized"><?php esc_html_e( 'Migrate: Import from Custom Post Type UI', 'pods' ); ?></h2>
13
14 <img src="<?php echo esc_url( PODS_URL ); ?>ui/images/pods-logo-notext-rgb-transparent.png" class="pods-leaf-watermark-right" />
15
16 <div id="pods-wizard-box" class="pods-wizard-steps-2 pods-wizard-hide-first">
17 <div id="pods-wizard-heading">
18 <ul>
19 <li class="pods-wizard-menu-current" data-step="1">
20 <i></i> <span>1</span> <?php esc_html_e( 'Step 1: Setup', 'pods' ); ?>
21 <em></em>
22 </li>
23 <li data-step="2">
24 <i></i> <span>2</span> <?php esc_html_e( 'Step 2: Migrate', 'pods' ); ?>
25 <em></em>
26 </li>
27 </ul>
28 </div>
29 <div id="pods-wizard-main">
30 <div id="pods-wizard-panel-1" class="pods-wizard-panel">
31 <div class="pods-wizard-content">
32 <p><?php esc_html_e( 'Custom Post Type UI provides an interface to create Custom Post Types and Custom Taxonomies. You can import these and their settings directly into Pods', 'pods' ); ?></p>
33 </div>
34
35 <div id="pods-wizard-options">
36 <div class="pods-wizard-options-list">
37 <div class="pods-wizard-option">
38 <a href="#pods-wizard-import" data-opt="0">
39 <div>
40 <h2><?php esc_html_e( 'Import Only', 'pods' ); ?></h2>
41
42 <p><?php esc_html_e( 'This will import your Custom Post Types and Taxonomies.', 'pods' ); ?></p>
43 </div>
44 <span>&#10095;</span>
45 </a>
46 </div>
47 <div class="pods-wizard-option">
48 <a href="#pods-wizard-import-clean" data-opt="1">
49 <div>
50 <h2><?php esc_html_e( 'Import and Clean Up', 'pods' ); ?></h2>
51
52 <p><?php esc_html_e( 'This will import your Custom Post Types and Taxonomies, and then remove them from Custom Post Type UI.', 'pods' ); ?></p>
53 </div>
54 <span>&#10095;</span>
55 </a>
56 </div>
57 </div>
58 </div>
59 </div>
60 <div id="pods-wizard-panel-2" class="pods-wizard-panel pods-wizard-option-content">
61 <div class="pods-wizard-content">
62 <p><?php esc_html_e( 'Choose below which Custom Post Types and Taxonomies you want to import into Pods', 'pods' ); ?></p>
63
64 <p>
65 <a href="#toggle" class="button pods-wizard-toggle-all"
66 data-toggle="all"><?php esc_html_e( 'Toggle everything on / off', 'pods' ); ?></a>
67 </p>
68 </div>
69
70 <div class="stuffbox">
71 <h3><label for="link_name"><?php esc_html_e( 'Choose Post Types to Import', 'pods' ); ?></label>
72 </h3>
73
74 <div class="inside pods-manage-field pods-dependency">
75 <?php
76 if ( ! empty( $post_types ) ) {
77 ?>
78 <div class="pods-field-option-group">
79 <p class="pods-field-option-group-label">
80 <?php esc_html_e( 'Available Post Types', 'pods' ); ?>
81 </p>
82
83 <div class="pods-pick-values pods-pick-checkbox">
84 <p>
85 <a href="#toggle" class="button pods-wizard-toggle-all"
86 data-toggle="post_type"><?php esc_html_e( 'Toggle all on / off', 'pods' ); ?></a>
87 </p>
88
89 <ul>
90 <?php
91 foreach ( $post_types as $post_type ) {
92 $post_type_name = pods_v( 'name', $post_type );
93 $post_type_label = pods_v( 'label', $post_type, ucwords( str_replace( '_', ' ', $post_type_name ) ) );
94 ?>
95 <li>
96 <div class="pods-field pods-boolean">
97 <?php
98 echo PodsForm::field( 'post_type[' . $post_type_name . ']', pods_v( 'post_type[' . $post_type_name . ']', 'post', true ), 'boolean', [
99 'boolean_yes_label' => $post_type_label . ' (' . $post_type_name . ')',
100 'disable_dfv' => true,
101 ] );
102 ?>
103 </div>
104 </li>
105 <?php
106 }
107 ?>
108 </ul>
109 </div>
110 </div>
111 <?php
112 } else {
113 ?>
114 <p class="padded"><?php esc_html_e( 'No Post Types were found.', 'pods' ); ?></p>
115 <?php
116 }//end if
117 ?>
118 </div>
119 </div>
120
121 <div class="stuffbox">
122 <h3><label for="link_name"><?php esc_html_e( 'Choose Taxonomies to Import', 'pods' ); ?></label>
123 </h3>
124
125 <div class="inside pods-manage-field pods-dependency">
126 <?php
127 if ( ! empty( $taxonomies ) ) {
128 ?>
129 <div class="pods-field-option-group">
130 <p class="pods-field-option-group-label">
131 <?php esc_html_e( 'Available Taxonomies', 'pods' ); ?>
132 </p>
133
134 <div class="pods-pick-values pods-pick-checkbox">
135 <p>
136 <a href="#toggle" class="button pods-wizard-toggle-all"
137 data-toggle="taxonomy"><?php esc_html_e( 'Toggle all on / off', 'pods' ); ?></a>
138 </p>
139
140 <ul>
141 <?php
142 foreach ( $taxonomies as $taxonomy ) {
143 $taxonomy_name = pods_v( 'name', $taxonomy );
144 $taxonomy_label = pods_v( 'label', $taxonomy, ucwords( str_replace( '_', ' ', $taxonomy_name ) ) );
145 ?>
146 <li>
147 <?php
148 echo PodsForm::field( 'taxonomy[' . $taxonomy_name . ']', pods_v( 'taxonomy[' . $taxonomy_name . ']', 'post', true ), 'boolean', [
149 'boolean_yes_label' => $taxonomy_label . ' (' . $taxonomy_name . ')',
150 'disable_dfv' => true,
151 ] );
152 ?>
153 </li>
154 <?php
155 }
156 ?>
157 </ul>
158 </div>
159 </div>
160 <?php
161 } else {
162 ?>
163 <p class="padded"><?php esc_html_e( 'No Taxonomies were found.', 'pods' ); ?></p>
164 <?php
165 }//end if
166 ?>
167 </div>
168 </div>
169 </div>
170
171 <div id="pods-wizard-actions" class="pods-wizard-button-interface">
172 <div id="pods-wizard-toolbar">
173 <button id="pods-wizard-start" class="button button-secondary"><?php esc_html_e( 'Start Over', 'pods' ); ?></button>
174 <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>
175 </div>
176 <div id="pods-wizard-finished">
177
178 </div>
179 </div>
180 </div>
181 </div>
182 </div>
183 </form>
184 </div>
185 <script type="text/javascript">
186 var pods_admin_submit_callback = function ( id ) {
187 id = parseInt( id );
188 document.location = 'admin.php?page=pods&do=create';
189 };
190
191 var pods_admin_option_select_callback = function ( $opt ) {
192 jQuery( '#pods_cleanup' ).val( $opt.data( 'opt' ) );
193 };
194
195 const toggle_all = {
196 all: true
197 };
198
199 jQuery( function ( $ ) {
200 $( '.pods-wizard-toggle-all' ).on( 'click', function ( e ) {
201 e.preventDefault();
202
203 const toggleData = $( this ).data( 'toggle' );
204
205 if ( 'undefined' == typeof toggle_all[toggleData] ) {
206 toggle_all[toggleData] = true;
207 }
208
209 let $parent;
210
211 if ( 'all' !== toggleData ) {
212 $parent = $( this ).closest( '.pods-field-option-group' );
213 } else {
214 $parent = $( this ).closest( '.pods-wizard-option-content' );
215 }
216
217 $parent.find( '.pods-field.pods-boolean input[type="checkbox"]' ).prop( 'checked', (!toggle_all[toggleData]) );
218
219 toggle_all[toggleData] = (!toggle_all[toggleData]);
220 } );
221
222 $( document ).Pods( 'validate' );
223 $( document ).Pods( 'submit' );
224 $( document ).Pods( 'wizard' );
225 $( document ).Pods( 'dependency' );
226 $( document ).Pods( 'advanced' );
227 $( document ).Pods( 'confirm' );
228 } );
229 </script>
230