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