Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pods 3.2.8 #7347

Merged
merged 77 commits into from
Nov 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
84b1ff3
Set version to 3.2.8-a-1
sc0ttkclark Aug 31, 2024
3745288
Support enabling or disabling wpautop for certain kinds of block content
sc0ttkclark Aug 31, 2024
d8259fb
Add fallback for `$pod->field()` and the `find` argument in case the …
sc0ttkclark Aug 31, 2024
70a0f51
Disable phpcs rule for brackets and phpstan fix
sc0ttkclark Aug 31, 2024
cca714d
Disable phpcs rule
sc0ttkclark Aug 31, 2024
2b1cdd5
Update TribalScents to StellarWP
sc0ttkclark Aug 31, 2024
1ceeb9d
Update phpcs rules
sc0ttkclark Aug 31, 2024
e1e50ee
Update rules
sc0ttkclark Aug 31, 2024
0e5ea93
Update phpcs
sc0ttkclark Aug 31, 2024
ce48433
Exclude rules
sc0ttkclark Aug 31, 2024
660d4b4
Update rules
sc0ttkclark Aug 31, 2024
d129992
Fix phpcs
sc0ttkclark Aug 31, 2024
1a42d6b
Update reference
sc0ttkclark Aug 31, 2024
79ee8df
Update jest
sc0ttkclark Aug 31, 2024
93f6ea9
Try updating enzyme testing adapter
sc0ttkclark Aug 31, 2024
42e283c
Install the enzyme adapter
sc0ttkclark Aug 31, 2024
eec817c
Update enzyme adapter
sc0ttkclark Aug 31, 2024
af61aca
Update adapter version
sc0ttkclark Sep 1, 2024
b6f064e
Update connection description
sc0ttkclark Sep 2, 2024
665f549
Add pods- prefix to the config paths supported
sc0ttkclark Sep 3, 2024
672e763
Add pods/templates/$template_name to the list of Pods templates hiera…
sc0ttkclark Sep 3, 2024
7b79dbb
Abstract the default template handling for Pod Pages and ensure they …
sc0ttkclark Sep 3, 2024
dba9367
Update template list
sc0ttkclark Sep 5, 2024
2878205
Update hook for default templates list
sc0ttkclark Sep 5, 2024
d78c005
Replace PNG arrows with CSS only arrows and run SCSS (#7161)
heybran Sep 9, 2023
f232f63
Update awe new pods screen HTML structure (#7161)
heybran Sep 29, 2023
8602870
Fix general paddings and add new grid layout (#7161)
heybran Sep 29, 2023
ac8466c
update add new pods screen (#7161)
heybran Dec 9, 2023
a528ba9
build css output (#7161)
heybran Dec 9, 2023
aa7deeb
remove commented out codes (#7161)
heybran Dec 9, 2023
d2847cc
Rebuild assets
sc0ttkclark Sep 7, 2024
37244ef
More UX updates
sc0ttkclark Sep 8, 2024
fb14490
Tweak heading text
sc0ttkclark Sep 8, 2024
7e69cfb
Remove extra padding
sc0ttkclark Sep 9, 2024
17031cb
More CSS work for Add New Pod screen
sc0ttkclark Sep 10, 2024
1caf45c
Disable more post types
sc0ttkclark Sep 10, 2024
17501b3
Update wizard handling for quick actions
sc0ttkclark Sep 10, 2024
09a28b0
Add taxonomy exclusion
sc0ttkclark Sep 10, 2024
70628d1
Auto rebuild assets
sc0ttkclark Sep 10, 2024
ace098f
Update padding for wizard
sc0ttkclark Sep 10, 2024
385b88d
Revamp wizard screens across all components
sc0ttkclark Sep 12, 2024
1a2cebe
Auto rebuild assets
sc0ttkclark Sep 12, 2024
ce4b9df
Update artifact
sc0ttkclark Sep 12, 2024
eb17b40
More fixes for slug sanitization
sc0ttkclark Sep 13, 2024
27fcb14
Fixes for phpstan
sc0ttkclark Sep 13, 2024
ef7bf11
Simplify slug logic
sc0ttkclark Sep 14, 2024
7b860e0
Fix HTML formatting
sc0ttkclark Sep 14, 2024
7b60b23
More phpcs fixes
sc0ttkclark Sep 14, 2024
bc8e42e
Add warnings/errors about PHP in Pod Pages and Templates
sc0ttkclark Sep 27, 2024
41f6d3f
Add more notices when using precode or page code
sc0ttkclark Sep 28, 2024
2d94c6b
Update notices for Pod Pages and add another inline notice for Pod Te…
sc0ttkclark Sep 29, 2024
c1e4ee6
Update escaping
sc0ttkclark Sep 29, 2024
e2599c9
Fix link and text for switching to file-based pod templates
sc0ttkclark Sep 29, 2024
9431767
Abstract more of the page/template PHP path handling and introduce a …
sc0ttkclark Oct 1, 2024
2a04501
Handle cleanups
sc0ttkclark Oct 1, 2024
445056e
More code exporting tweaks
sc0ttkclark Oct 1, 2024
5287798
Maybe process magic tags for file-based templates
sc0ttkclark Oct 1, 2024
620f003
Update notices with link to use Migrate PHP component
sc0ttkclark Oct 3, 2024
d5af932
More updates for PHP file-based template migration and support for Po…
sc0ttkclark Oct 3, 2024
0f2fe47
Template part handling for passing along $pods var into Pod Page temp…
sc0ttkclark Oct 4, 2024
37672cd
Fix php warnings with methods that expect string when template code i…
sc0ttkclark Oct 4, 2024
9dad299
Ensure template code (if set) is not run if the corresponding templat…
sc0ttkclark Oct 4, 2024
5887ead
Validate non empty value
JoryHogeveen Nov 5, 2024
f5884cd
Auto rebuild assets
sc0ttkclark Nov 17, 2024
ffba468
Update NPM packages and migrate SCSS from import to use
sc0ttkclark Nov 17, 2024
caa4ea7
Auto rebuild assets
sc0ttkclark Nov 17, 2024
c445492
Update wizard text, improve validation of migration for templates/pages
sc0ttkclark Nov 17, 2024
403e416
Start the changelog
sc0ttkclark Nov 17, 2024
b7595ca
Fix PHP notice for array key in some situations
sc0ttkclark Nov 17, 2024
9bdfaac
Ensure sister ID association sets all of the related items as necessa…
sc0ttkclark Nov 17, 2024
c40e87f
Move load_plugin_textdomain usage into init and make it optional
sc0ttkclark Nov 17, 2024
4ccfb0e
When getting plugin data, don’t make translatable
sc0ttkclark Nov 17, 2024
7e2fe07
Show text when there are no objects to migrate
sc0ttkclark Nov 17, 2024
d91a00e
Update changelog
sc0ttkclark Nov 17, 2024
011a845
Pods 3.2.8
sc0ttkclark Nov 17, 2024
6b404d4
Update changelog
sc0ttkclark Nov 17, 2024
a780c71
Fix template name issue
sc0ttkclark Nov 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/tests-php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ jobs:
# Upload artifacts (On failure)
# ------------------------------------------------------------------------------
- name: Upload artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
if: failure()
with:
name: output ${{ matrix.suite }}
Expand Down
2 changes: 1 addition & 1 deletion .phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<arg name="colors"/>
<arg name="report" value="full,summary"/>

<rule ref="TribalScents"/>
<rule ref="StellarWP"/>
<rule ref="WordPress-VIP-Go"/>
<rule ref="WordPress">
<exclude name="WordPress.Files.FileName"/>
Expand Down
21 changes: 21 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,27 @@ Found a bug? Have a great feature idea? Get on GitHub and tell us about it and w

Our GitHub has the full list of all prior releases of Pods: https://github.com/pods-framework/pods/releases

= 3.2.8 - November 17th, 2024 =

REMINDER: PHP support for Pod Templates and Pod Pages been turned off by default in Pods 3.2.7+ (`PODS_DISABLE_EVAL` constant set to `false` can be used to re-enable it). It will be completely removed in Pods 3.3 after being deprecated back in Pods 2.3. (@sc0ttkclark)

* Feature: Migrate the PHP in your Pod Templates and Pod Pages directly into your current theme with a new Pods Admin > Tools > Migrate PHP tool. We recommend you use a child theme that you control. PHP warnings now appear on the Pod Template and Pod Page editor screens to prompt you to run the migration. (@sc0ttkclark)
* Feature: Updated the design and user experience of the various guided screens inside of the Pods Admin to make it easier to read and click through on small screens. (@sc0ttkclark, @heybran)
* Enhanced: Pod Page template part handling for PHP template files now passes the `$pods` variable. (@sc0ttkclark)
* Enhanced: Added support for parsing magic tags in Pod Template files in the theme when you set the PHP header comment `Magic Tags: Enabled`. (@sc0ttkclark)
* Enhanced: Run wpautop on Pods Item List and Pods Related Item List blocks for the "not found" content if they are not already formatted. (@sc0ttkclark)
* Fixed: Only running wpautop for block the Pods Field block content if it does not contain div, ul, ol, heading, or p HTML tags. (@sc0ttkclark)
* Fixed: Resolve issue with empty strings showing when using magic tags before/after functionality. (@JoryHogeveen)
* Fixed: Ignore more internal WP post types and taxonomies plus others from other plugins.
* Fixed: Move load_plugin_textdomain usage into init and make it optional with the constant `PODS_LOAD_TEXTDOMAIN` set to `true`. It is no longer needed for WordPress.org plugins but may be needed in the future for testing. (@sc0ttkclark)
* Fixed: When getting plugin data, don't make it translatable. (@sc0ttkclark)
* Fixed: When saving bidirectional relationship, attempt to save hook up existing related items data in the `wp_podsrel` table with the bidirectional connection. (@sc0ttkclark)
* Fixed: Resolve PHP notices with site debug information. (@sc0ttkclark)
* Fixed: Resolve PHP warnings with empty template code. (@sc0ttkclark)
* Fixed: More improvements to Pod Page and Pod Template file loading from themes. (@sc0ttkclark)
* Fixed: Resolve issue with slug fields not formatting as expected. (@sc0ttkclark)
* Fixed: SCSS migrated from `@import` to `@use` for compatibility with the latest versions of our SCSS scripting. (@sc0ttkclark)

= 3.2.7.1 - October 9th, 2024 =

* Security: Lock down heading field to only specific allowed HTML tags and preventing it from being used to insert malicious scripts. Props to the CleanTalk / Dmitrii Ignatyev for responsibly reporting this. (@sc0ttkclark)
Expand Down
2 changes: 1 addition & 1 deletion classes/Pods.php
Original file line number Diff line number Diff line change
Expand Up @@ -4329,7 +4329,7 @@ private function process_magic_tags( $tag ) {
) );
}

if ( null !== $value && false !== $value ) {
if ( $value || is_numeric( $value ) ) {
return $before . $value . $after;
}

Expand Down
39 changes: 30 additions & 9 deletions classes/PodsAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -4017,7 +4017,9 @@ public function save_field( $params, $table_operation = true, $sanitized = false

pods_query( '
UPDATE `@wp_podsrel`
SET `related_field_id` = 0
SET
`related_pod_id` = 0,
`related_field_id` = 0
WHERE `field_id` = %d
', array(
$old_sister_id,
Expand All @@ -4028,14 +4030,33 @@ public function save_field( $params, $table_operation = true, $sanitized = false
update_post_meta( $sister_id, 'sister_id', $params->id );

if ( true === $db && pods_podsrel_enabled( $field, 'save' ) ) {
pods_query( '
UPDATE `@wp_podsrel`
SET `related_field_id` = %d
WHERE `field_id` = %d
', array(
$params->id,
$sister_id,
) );
$sister_field = $this->load_field( [ 'id' => $sister_id ] );

if ( $sister_field ) {
pods_query( '
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[phpcs] reported by reviewdog 🐶
PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket
Opening parenthesis of a multi-line function call must be the last content on the line

UPDATE `@wp_podsrel`
SET
`related_pod_id` = %d,
`related_field_id` = %d
WHERE `field_id` = %d
', [
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[phpcs] reported by reviewdog 🐶
PEAR.Functions.FunctionCallSignature.MultipleArguments
Only one argument is allowed per line in a multi-line function call

$pod['id'],
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[phpcs] reported by reviewdog 🐶
WordPress.Arrays.ArrayIndentation.ItemNotAligned
Array item not aligned correctly; expected 4 spaces but found 24

$params->id,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[phpcs] reported by reviewdog 🐶
WordPress.Arrays.ArrayIndentation.ItemNotAligned
Array item not aligned correctly; expected 4 spaces but found 24

$sister_id,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[phpcs] reported by reviewdog 🐶
WordPress.Arrays.ArrayIndentation.ItemNotAligned
Array item not aligned correctly; expected 4 spaces but found 24

] );
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[phpcs] reported by reviewdog 🐶
WordPress.Arrays.ArrayIndentation.CloseBraceNotAligned
Array closer not aligned correctly; expected 0 space(s) but found 20

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[phpcs] reported by reviewdog 🐶
PEAR.Functions.FunctionCallSignature.CloseBracketLine
Closing parenthesis of a multi-line function call must be on a line by itself


pods_query( '
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[phpcs] reported by reviewdog 🐶
PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket
Opening parenthesis of a multi-line function call must be the last content on the line

UPDATE `@wp_podsrel`
SET
`related_pod_id` = %d,
`related_field_id` = %d
WHERE `field_id` = %d
', [
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[phpcs] reported by reviewdog 🐶
PEAR.Functions.FunctionCallSignature.MultipleArguments
Only one argument is allowed per line in a multi-line function call

$sister_field->get_parent_id(),
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[phpcs] reported by reviewdog 🐶
WordPress.Arrays.ArrayIndentation.ItemNotAligned
Array item not aligned correctly; expected 4 spaces but found 24

$sister_id,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[phpcs] reported by reviewdog 🐶
WordPress.Arrays.ArrayIndentation.ItemNotAligned
Array item not aligned correctly; expected 4 spaces but found 24

$params->id,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[phpcs] reported by reviewdog 🐶
WordPress.Arrays.ArrayIndentation.ItemNotAligned
Array item not aligned correctly; expected 4 spaces but found 24

] );
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[phpcs] reported by reviewdog 🐶
WordPress.Arrays.ArrayIndentation.CloseBraceNotAligned
Array closer not aligned correctly; expected 0 space(s) but found 20

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[phpcs] reported by reviewdog 🐶
PEAR.Functions.FunctionCallSignature.CloseBracketLine
Closing parenthesis of a multi-line function call must be on a line by itself

}
}
} elseif ( 0 < $old_sister_id ) {
delete_post_meta( $old_sister_id, 'sister_id' );
Expand Down
11 changes: 10 additions & 1 deletion classes/PodsAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -4817,7 +4817,16 @@ public function add_debug_information( $info ) {
$value = $setting_field['site_health_data'][ $value ];
} elseif ( $has_value && isset( $setting_field['data'] ) && isset( $setting_field['data'][ $value ] ) ) {
$value = $setting_field['data'][ $value ];
} elseif ( 'boolean' === $setting_field['data'] || '1' === $value || '0' === $value ) {
} elseif (
(
isset( $setting_field['data'] )
&& 'boolean' === $setting_field['data']
)
&& (
'1' === $value
|| '0' === $value
)
) {
$value = '1' === $value ? __( 'Yes', 'pods' ) : __( 'No', 'pods' );
}
}
Expand Down
8 changes: 4 additions & 4 deletions classes/PodsInit.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,6 @@
define( 'PODS_DISABLE_EVAL', true );
}

if ( ! defined( 'PODS_TEXTDOMAIN' ) || PODS_TEXTDOMAIN ) {
load_plugin_textdomain( 'pods' );
}

if ( ! defined( 'PODS_STATS_TRACKING' ) || PODS_STATS_TRACKING ) {
$this->stats_tracking( PODS_FILE, 'pods' );
}
Expand Down Expand Up @@ -566,6 +562,10 @@
if ( method_exists( $avatar, 'get_avatar_data' ) ) {
add_filter( 'get_avatar_data', array( $avatar, 'get_avatar_data' ), 10, 2 );
}

if ( defined( 'PODS_TEXTDOMAIN' ) && PODS_TEXTDOMAIN ) {
load_plugin_textdomain( 'pods' );
}
}

/**
Expand Down Expand Up @@ -2424,9 +2424,9 @@
pods_container_register_service_provider( \Pods\Service_Provider::class );
pods_container_register_service_provider( \Pods\Admin\Service_Provider::class );
pods_container_register_service_provider( \Pods\Blocks\Service_Provider::class );
pods_container_register_service_provider( \Pods\Integrations\Service_Provider::class );

Check failure on line 2427 in classes/PodsInit.php

View workflow job for this annotation

GitHub Actions / phpstan / phpstan (8.3)

Class Pods\Integrations\Service_Provider not found.

Check failure on line 2427 in classes/PodsInit.php

View workflow job for this annotation

GitHub Actions / phpstan / phpstan (8.2)

Class Pods\Integrations\Service_Provider not found.
pods_container_register_service_provider( \Pods\REST\V1\Service_Provider::class );
pods_container_register_service_provider( \Pods\Integrations\WPGraphQL\Service_Provider::class );

Check failure on line 2429 in classes/PodsInit.php

View workflow job for this annotation

GitHub Actions / phpstan / phpstan (8.3)

Class Pods\Integrations\WPGraphQL\Service_Provider not found.

Check failure on line 2429 in classes/PodsInit.php

View workflow job for this annotation

GitHub Actions / phpstan / phpstan (8.2)

Class Pods\Integrations\WPGraphQL\Service_Provider not found.

// Add WP-CLI commands.
if ( defined( 'WP_CLI' ) && WP_CLI ) {
Expand Down
11 changes: 11 additions & 0 deletions classes/PodsMeta.php
Original file line number Diff line number Diff line change
Expand Up @@ -2949,6 +2949,16 @@ public function is_type_covered( $type, $object_name = null ) {
'wp_navigation' => true,
'wp_template' => true,
'wp_template_part' => true,
'wp_font_face' => true,
'wp_font_family' => true,
// Disable ACF post types.
'acf-taxonomy' => true,
'acf-post-type' => true,
'acf-field-group' => true,
'acf-field' => true,
// Disable Advanced views.
'acf_views' => true,
'acf_cards' => true,
// Disable Beaver Builder post types.
'fl-theme-layout' => true,
'fl-builder-template' => true,
Expand All @@ -2973,6 +2983,7 @@ public function is_type_covered( $type, $object_name = null ) {
'post_format' => true,
'wp_theme' => true,
'wp_template_part_area' => true,
'wp_pattern_category' => true,
// Disable Beaver Builder taxonomies.
'fl-builder-template-category' => true,
'fl-builder-template-type' => true,
Expand Down
110 changes: 78 additions & 32 deletions components/Migrate-ACF/ui/wizard.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,57 +9,67 @@
<?php echo PodsForm::field( '_wpnonce', wp_create_nonce( 'pods-component-' . $component . '-' . $method ), 'hidden' ); ?>
<?php echo PodsForm::field( 'cleanup', 0, 'hidden', array( 'attributes' => array( 'id' => 'pods_cleanup' ) ) ); ?>

<h2 class="italicized"><?php _e( 'Migrate: Import from Advanced Custom Fields', 'pods' ); ?></h2>
<h2 class="italicized"><?php esc_html_e( 'Migrate: Import from Advanced Custom Fields', 'pods' ); ?></h2>

<img src="<?php echo esc_url( PODS_URL ); ?>ui/images/pods-logo-notext-rgb-transparent.png" class="pods-leaf-watermark-right" />

<div id="pods-wizard-box" class="pods-wizard-steps-2 pods-wizard-hide-first">
<div id="pods-wizard-heading">
<ul>
<li class="pods-wizard-menu-current" data-step="1">
<i></i> <span>1</span> <?php _e( 'Setup', 'pods' ); ?>
<i></i> <span>1</span> <?php esc_html_e( 'Step 1: Setup', 'pods' ); ?>
<em></em>
</li>
<li data-step="2">
<i></i> <span>2</span> <?php _e( 'Migrate', 'pods' ); ?>
<i></i> <span>2</span> <?php esc_html_e( 'Step 2: Migrate', 'pods' ); ?>
<em></em>
</li>
</ul>
</div>
<div id="pods-wizard-main">
<div id="pods-wizard-panel-1" class="pods-wizard-panel">
<div class="pods-wizard-content">
<p><?php _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>
<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>
</div>
<div id="pods-wizard-options">
<div class="pods-wizard-option">
<a href="#pods-wizard-import" data-opt="0">
<h2><?php _e( 'Import Only', 'pods' ); ?></h2>

<p><?php _e( 'This will import your Custom Post Types and Taxonomies.', 'pods' ); ?></p>
<p><?php _e( 'Until you remove them from Advanced Custom Fields, these will be treated by Pods as extended content types.', 'pods' ); ?></p>
</a>

<p><br /></p>
</div>
<div class="pods-wizard-option">
<a href="#pods-wizard-import-clean" data-opt="1">
<h2><?php _e( 'Import and Clean Up', 'pods' ); ?></h2>

<p><?php _e( 'This will import your Custom Post Types and Taxonomies, and then remove them from Advanced Custom Fields.', 'pods' ); ?></p>
</a>

<p><br /></p>
<div id="pods-wizard-options">
<div class="pods-wizard-options-list">
<div class="pods-wizard-option">
<a href="#pods-wizard-import" data-opt="0">
<div>
<h2><?php esc_html_e( 'Import Only', 'pods' ); ?></h2>

<p><?php esc_html_e( 'This will import your Custom Post Types and Taxonomies.', 'pods' ); ?></p>
<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>
</div>
<span>&#10095;</span>
</a>
</div>
<div class="pods-wizard-option">
<a href="#pods-wizard-import-clean" data-opt="1">
<div>
<h2><?php esc_html_e( 'Import and Clean Up', 'pods' ); ?></h2>

<p><?php esc_html_e( 'This will import your Custom Post Types and Taxonomies, and then remove them from Advanced Custom Fields.', 'pods' ); ?></p>
</div>
<span>&#10095;</span>
</a>
</div>
</div>
</div>
</div>
<div id="pods-wizard-panel-2" class="pods-wizard-panel">
<div id="pods-wizard-panel-2" class="pods-wizard-panel pods-wizard-option-content">
<div class="pods-wizard-content">
<p><?php _e( 'Choose below which Custom Post Types and Taxonomies you want to import into Pods', 'pods' ); ?></p>
<p><?php esc_html_e( 'Choose below which Custom Post Types and Taxonomies you want to import into Pods', 'pods' ); ?></p>

<p>
<a href="#toggle" class="button pods-wizard-toggle-all"
data-toggle="all"><?php esc_html_e( 'Toggle everything on / off', 'pods' ); ?></a>
</p>
</div>

<div class="stuffbox">
<h3><label for="link_name"><?php _e( 'Choose Post Types to Import', 'pods' ); ?></label>
<h3><label for="link_name"><?php esc_html_e( 'Choose Post Types to Import', 'pods' ); ?></label>
</h3>

<div class="inside pods-manage-field pods-dependency">
Expand All @@ -68,10 +78,15 @@
?>
<div class="pods-field-option-group">
<p class="pods-field-option-group-label">
<?php _e( 'Available Post Types', 'pods' ); ?>
<?php esc_html_e( 'Available Post Types', 'pods' ); ?>
</p>

<div class="pods-pick-values pods-pick-checkbox">
<p>
<a href="#toggle" class="button pods-wizard-toggle-all"
data-toggle="post_type"><?php esc_html_e( 'Toggle all on / off', 'pods' ); ?></a>
</p>

<ul>
<?php
foreach ( $post_types as $post_type ) {
Expand All @@ -97,15 +112,15 @@
<?php
} else {
?>
<p class="padded"><?php _e( 'No Post Types were found.', 'pods' ); ?></p>
<p class="padded"><?php esc_html_e( 'No Post Types were found.', 'pods' ); ?></p>
<?php
}//end if
?>
</div>
</div>

<div class="stuffbox">
<h3><label for="link_name"><?php _e( 'Choose Taxonomies to Import', 'pods' ); ?></label>
<h3><label for="link_name"><?php esc_html_e( 'Choose Taxonomies to Import', 'pods' ); ?></label>
</h3>

<div class="inside pods-manage-field pods-dependency">
Expand All @@ -114,10 +129,15 @@
?>
<div class="pods-field-option-group">
<p class="pods-field-option-group-label">
<?php _e( 'Available Taxonomies', 'pods' ); ?>
<?php esc_html_e( 'Available Taxonomies', 'pods' ); ?>
</p>

<div class="pods-pick-values pods-pick-checkbox">
<p>
<a href="#toggle" class="button pods-wizard-toggle-all"
data-toggle="taxonomy"><?php esc_html_e( 'Toggle all on / off', 'pods' ); ?></a>
</p>

<ul>
<?php
foreach ( $taxonomies as $taxonomy ) {
Expand All @@ -141,7 +161,7 @@
<?php
} else {
?>
<p class="padded"><?php _e( 'No Taxonomies were found.', 'pods' ); ?></p>
<p class="padded"><?php esc_html_e( 'No Taxonomies were found.', 'pods' ); ?></p>
<?php
}//end if
?>
Expand All @@ -151,8 +171,8 @@

<div id="pods-wizard-actions" class="pods-wizard-button-interface">
<div id="pods-wizard-toolbar">
<button id="pods-wizard-start" class="button button-secondary"><?php _e( 'Start Over', 'pods' ); ?></button>
<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 _e( 'Next Step', 'pods' ); ?></button>
<button id="pods-wizard-start" class="button button-secondary"><?php esc_html_e( 'Start Over', 'pods' ); ?></button>
<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>
</div>
<div id="pods-wizard-finished">

Expand All @@ -173,7 +193,33 @@
jQuery( '#pods_cleanup' ).val( $opt.data( 'opt' ) );
};

const toggle_all = {
all: true
};

jQuery( function ( $ ) {
$( '.pods-wizard-toggle-all' ).on( 'click', function ( e ) {
e.preventDefault();

const toggleData = $( this ).data( 'toggle' );

if ( 'undefined' == typeof toggle_all[toggleData] ) {
toggle_all[toggleData] = true;
}

let $parent;

if ( 'all' !== toggleData ) {
$parent = $( this ).closest( '.pods-field-option-group' );
} else {
$parent = $( this ).closest( '.pods-wizard-option-content' );
}

$parent.find( '.pods-field.pods-boolean input[type="checkbox"]' ).prop( 'checked', (!toggle_all[toggleData]) );

toggle_all[toggleData] = (!toggle_all[toggleData]);
} );

$( document ).Pods( 'validate' );
$( document ).Pods( 'submit' );
$( document ).Pods( 'wizard' );
Expand Down
Loading
Loading