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.0 #7268

Merged
merged 44 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
391686f
Fix custom capability fallback
JoryHogeveen Jan 30, 2024
d2496a7
Set version to 3.1.5-a-1
sc0ttkclark Feb 29, 2024
6e194ad
Fix trim() PHP deprecated notice
sc0ttkclark Feb 29, 2024
855fb3c
Fix plupload reference
sc0ttkclark Mar 1, 2024
3711103
Add more checks for window.wpEditorL10n existing before calling thing…
sc0ttkclark Mar 1, 2024
aa22cbb
Rebuild assets
sc0ttkclark Mar 1, 2024
101efab
Auto rebuild assets
sc0ttkclark Mar 1, 2024
cab5c78
Fix compatibility action args sent for set_transient and setted_trans…
sc0ttkclark Mar 15, 2024
c424ef0
Workflow updates
sc0ttkclark Mar 15, 2024
decd070
Add support for WP 6.4 meta revisions
sc0ttkclark Mar 15, 2024
4fa7bc6
Fix REST API options in field so it doesn’t show unnecessary sections
sc0ttkclark Mar 15, 2024
eb812f4
Support Block Bindings API in WP 6.5 and Gb
sc0ttkclark Mar 15, 2024
5c66f56
Strip non-content attributes of HTML formatting
sc0ttkclark Mar 17, 2024
3e406ed
Phpdoc updates
sc0ttkclark Mar 20, 2024
479603f
REST API / Revision logic consolidation for register_meta() usage
sc0ttkclark Mar 20, 2024
934feba
Fix restrict/unrestrict of the dynamic features logic on Access Right…
sc0ttkclark Mar 22, 2024
aae5be4
Allow empty arrays to be returned from args initialization for post-b…
sc0ttkclark Mar 22, 2024
28f2c50
Improve field label/description for Additional User Capabilities for …
sc0ttkclark Mar 22, 2024
dd9189c
Add first and last version to the site health info
sc0ttkclark Mar 23, 2024
71eb873
Messages implementation fix
sc0ttkclark Mar 23, 2024
6c757cd
Add bypass_detect_loop to Pods shortcode logic to allow bypassing in_…
sc0ttkclark Mar 23, 2024
23b4773
Add a workaround for unrestricted display of private posts
sc0ttkclark Mar 23, 2024
d403566
Remove unnecessary build
sc0ttkclark Mar 23, 2024
96ea490
Add support for setting default values when a field is empty in a form
sc0ttkclark Mar 23, 2024
e355894
Tweak for default value field description and fix Other Options from …
sc0ttkclark Mar 23, 2024
821a6d4
Update help text to explain that you can separate multiple default va…
sc0ttkclark Mar 23, 2024
91eb465
Fix pod value default handling for new fields/groups modals to preven…
sc0ttkclark Mar 23, 2024
730a4ad
Auto rebuild assets
sc0ttkclark Mar 23, 2024
af8786a
Fix default evaluate tags handling of default values with magic tags …
sc0ttkclark Mar 23, 2024
ef6a529
Add new Evaluate Tags option and work with it during saving of items …
sc0ttkclark Mar 23, 2024
43774b2
When duplicating pods make sure to ensure the new pod name is properl…
sc0ttkclark Mar 23, 2024
45cfc6f
Blueprint work and update . files
sc0ttkclark Mar 24, 2024
b4d08d5
Update binding path to prevent notices
sc0ttkclark Mar 24, 2024
05521fd
Fix access rights defaults handling, it should be prompting old insta…
sc0ttkclark Mar 25, 2024
eaa238e
Ensure static cache is cleared when registering new blocks
sc0ttkclark Mar 25, 2024
1707c60
Ensure revision settings only show for Post Types with Meta storage
sc0ttkclark Mar 25, 2024
3330c70
Enforce strict checks so that the capability type is never just empty
sc0ttkclark Mar 25, 2024
86d73fd
Merge pull request #7250 from pods-framework/feature/7218-fix-cap-fal…
sc0ttkclark Mar 25, 2024
7485639
Check if pod can use dynamic features before attempting register_meta…
sc0ttkclark Mar 25, 2024
c1a394a
Prep changelog
sc0ttkclark Mar 25, 2024
ebfac63
Feature/7196 tab support improvement (#7198)
heybran Mar 25, 2024
bef9e7c
Auto rebuild assets
sc0ttkclark Mar 25, 2024
045258a
Pods 3.2.0
sc0ttkclark Mar 25, 2024
c7c89ae
Make REST API options as radios instead of dropdowns to make it more …
sc0ttkclark Mar 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .distignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Export ignore handling

# Directories
/.git
/.github
/.wordpress-org
/bin
Expand Down
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ tests/_support/_generated/* linguist-generated=true
# Export ignore handling

# Directories
/.git export-ignore
/.github export-ignore
/.wordpress-org export-ignore
/bin export-ignore
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/prepare-release-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
description: 'New plugin version (without the "-a-1"), defaults to the next incremental version from package.json'
required: false
version_increment:
description: 'Version increment scheme (if incrementing the package.json version)'
description: 'OR Version increment scheme (if incrementing the package.json version; patch=x.x.x, minor=x.x, major=x.0)'
required: true
type: choice
default: 'patch'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/wordpress-plugin-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ jobs:
with:
slack-bot-user-oauth-access-token: ${{ secrets.SLACK_BOT_USER_OAUTH_ACCESS_TOKEN }}
slack-channel: C02SWND14
slack-text: The pods tag has been deployed to svn.wordpress.org 🎉
slack-text: The ${{ github.event.repository.name }} tag has been deployed to svn.wordpress.org 🎉
20 changes: 20 additions & 0 deletions .github/workflows/wordpress-version-checker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: "WordPress version checker"
on:
push:
branches:
- main
- release/*
schedule:
- cron: '0 0 * * *'

permissions:
issues: write

jobs:
wordpress-version-checker:
runs-on: ubuntu-latest
steps:
- name: WordPress version checker
uses: skaut/wordpress-version-checker@v1.0.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
37 changes: 37 additions & 0 deletions .wordpress-org/blueprints/blueprint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"landingPage": "\/wp-admin\/admin.php?page=pods&pods_wasm_demo=1",
"preferredVersions": {
"php": "8.0",
"wp": "latest"
},
"phpExtensionBundles": [
"kitchen-sink"
],
"features": {
"networking": true
},
"steps": [
{
"step": "installPlugin",
"pluginZipFile": {
"resource": "wordpress.org\/plugins",
"slug": "pods"
},
"options": {
"activate": true
}
},
{
"step": "installTheme",
"themeZipFile": {
"resource": "wordpress.org\/themes",
"slug": "raft"
}
},
{
"step": "login",
"username": "admin",
"password": "password"
}
]
}
30 changes: 30 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,36 @@ 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.0 - March 25th, 2024 =

* Feature: New support for Custom Field revisions in Pods that are Post Types that use Meta storage. You can optionally enable the feature per-pod or per-field. #7265 (@sc0ttkclark)
* Feature: New support for WordPress `register_meta()` for all Pods fields on meta-based Pods. You can enable this feature in Pods Admin > Settings > "Register meta fields". (@sc0ttkclark)
* Feature: New support for specifying where your Custom Fields show in REST API responses for Pods that support that. You can choose from Object (response.field_name) or Meta (response.meta.field_name). (@sc0ttkclark)
* Feature: New support for Custom Fields in the new [WordPress 6.5 Block Bindings API](https://make.wordpress.org/core/2024/03/06/new-feature-the-block-bindings-api/) for the `core/post-meta` source. To use your custom fields there, you will need to enable "Register meta fields" in your Pods Admin > Settings and set your Pod to show it's REST API fields in the "Meta" location instead of Object. (@sc0ttkclark)
* Feature: New custom binding source support for the [WordPress 6.5 Block Bindings API](https://make.wordpress.org/core/2024/03/06/new-feature-the-block-bindings-api/). Specify your source as `pods/bindings-field` and then just pass the same arguments you would pass for a normal `[pods]` shortcode or block. This will bind that dynamic output to the block you are working with. (@sc0ttkclark)
* Feature: Now you can specify whether to default values for a Pods field when the field is empty. This works great for when you add a new field to a Pod and you want to edit an existing item that did not have a field value set. The default value will be used in that circumstance. (@sc0ttkclark)
* Feature: Support for multiple default values when working with a multi-select field. Now you can just separate your values with a comma and they will be set as the default values. (@sc0ttkclark)
* Feature: Now you can specify whether to evaluate magic tags for default values like `{@user.ID}`. (@sc0ttkclark)
* Tweak: New option for Pods shortcodes when used in plugins like Elementor to bypass detecting the loop and to just use whatever ID/post type is available. Use the `bypass_detect_loop="1"` attribute. #7269 (@sc0ttkclark)
* Tweak: Added first used and last installed Pods versions to the Site Health information to be more helpful with debugging. (@sc0ttkclark)
* Tweak: Improved the field label/description for Additional User Capabilities field in the CPT settings. (@sc0ttkclark)
* Fixed: Resolved an annoying issue when adding a new group or field where it would reset the Pod label to the name (slug) of the pod. (@sc0ttkclark)
* Fixed: Updated logic for default value handling when using magic tags for internal field configs to ensure the magic tags get evaluated. (@sc0ttkclark)
* Fixed: Resolve issue with `pods_register_block_type()` not clearing the known blocks cache when registering them. #7167 (@sc0ttkclark)
* Fixed: PHP fatal errors resolved with `array_combine()` usage from changes in WP 6.5. #7266 (@sc0ttkclark)
* Fixed: Custom capability fallbacks when the option is empty now properly fallback to the default capability using that post type name. #7250 (@JoryHogeveen)
* Fixed: PHP deprecated notice with `trim()`. (@sc0ttkclark)
* Fixed: Resolved plupload browse button references to prevent JS console errors. (@sc0ttkclark)
* Fixed: Resolved issue with `window.wpEditorL10n` calls to more safely check for it to prevent JS console errors. (@sc0ttkclark)
* Fixed: Updated the implementation of the compatibility hooks for `set_transient` and `setted_transient` hooks have the proper args expected sent. (@sc0ttkclark)
* Fixed: Empty REST API fields no longer show when the pod doesn't support REST API. (@sc0ttkclark)
* Fixed: Restrict/unrestrict dynamic features logic now properly updates all of the associated Pod settings it needs to in the Access Rights Review screen. (@sc0ttkclark)
* Fixed: Empty arrays now return correctly in Pod / Group / Field settings instead of using their defaults when empty. (@sc0ttkclark)
* Fixed: Resolve potential issues with REST API in certain circumstances which would throw exceptions with the Pods REST API Messages object. (@sc0ttkclark)
* Fixed: Resolve issues when duplicating pods where the new pod name is over the limit and prevents creating the new pod correctly. (@sc0ttkclark)
* Fixed: Access Rights Review notice now only shows on existing installs updating from pre-3.1 instead of showing on new 3.1+ installs too. (@sc0ttkclark)
* Fixed: Accessibility issues with tabbing resolved for Pods Admin > Edit Pods table and Pods Admin > Edit Pod fields list table when working with row actions. #7196 #7198 (@heybran, @sc0ttkclark)

= 3.1.4 - February 28th, 2024 =

* Fixed: Defaults now show correctly for checkbox groups in the Edit Field modals. (@sc0ttkclark)
Expand Down
3 changes: 2 additions & 1 deletion classes/Pods.php
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,8 @@ public function field( $name, $single = null, $raw = false ) {
$params->single = (boolean) $params->single;
}

$params->name = trim( $params->name );
$params->name = trim( (string) $params->name );

if ( is_array( $params->name ) || '' === $params->name ) {
return null;
}
Expand Down
58 changes: 44 additions & 14 deletions classes/PodsAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -899,9 +899,10 @@ public function get_wp_object_fields( $object = 'post_type', $pod = null, $refre
'pick_data_storage' => 'object',
'pick_output' => 'ids',
'options' => [
'pick_format_type' => 'single',
'pick_format_single' => 'autocomplete',
'default_value' => '{@user.ID}',
'pick_format_type' => 'single',
'pick_format_single' => 'autocomplete',
'default_value' => '{@user.ID}',
'default_evaluate_tags' => 1,
],
],
'post_date' => [
Expand Down Expand Up @@ -2127,13 +2128,14 @@ public function save_pod( $params, $sanitized = false, $db = true ) {
'datetime_time_format' => 'h_mm_ss_A',
],
'author' => [
'name' => 'author',
'label' => 'Author',
'type' => 'pick',
'pick_object' => 'user',
'pick_format_type' => 'single',
'pick_format_single' => 'autocomplete',
'default_value' => '{@user.ID}',
'name' => 'author',
'label' => 'Author',
'type' => 'pick',
'pick_object' => 'user',
'pick_format_type' => 'single',
'pick_format_single' => 'autocomplete',
'default_value' => '{@user.ID}',
'default_evaluate_tags' => 1,
],
'permalink' => [
'name' => 'permalink',
Expand Down Expand Up @@ -5005,7 +5007,13 @@ public function save_pod_item( $params ) {
|| 'save' === $params->from
|| true === pods_permission( $fields[ $field ] )
) {
$value = PodsForm::default_value( pods_v( $field, 'post' ), $field_data['type'], $field, pods_v( 'options', $field_data, $field_data, true ), $pod, $params->id );
$field_options = $field_data;

if ( is_array( $field_options ) ) {
$field_options = pods_v( 'options', $field_options, $field_options, true );
}

$value = PodsForm::default_value( pods_v( $field, 'post' ), $field_data['type'], $field, $field_options, $pod, $params->id );

if ( null !== $value && '' !== $value && false !== $value ) {
$fields[ $field ]['value'] = $value;
Expand All @@ -5026,7 +5034,13 @@ public function save_pod_item( $params ) {
continue;
}

$value = PodsForm::default_value( pods_v( $field, 'post' ), $field_data['type'], $field, pods_v( 'options', $field_data, $field_data, true ), $pod, $params->id );
$field_options = $field_data;

if ( is_array( $field_options ) ) {
$field_options = pods_v( 'options', $field_options, $field_options, true );
}

$value = PodsForm::default_value( pods_v( $field, 'post' ), $field_data['type'], $field, $field_options, $pod, $params->id );

if ( null !== $value && '' !== $value && false !== $value ) {
$object_fields[ $field ]['value'] = $value;
Expand Down Expand Up @@ -5106,7 +5120,13 @@ public function save_pod_item( $params ) {
continue;
}

$value = PodsForm::default_value( pods_v( $field, 'post' ), $field_data['type'], $field, pods_v( 'options', $field_data, $field_data, true ), $pod, $params->id );
$field_options = $field_data;

if ( is_array( $field_options ) ) {
$field_options = pods_v( 'options', $field_options, $field_options, true );
}

$value = PodsForm::default_value( pods_v( $field, 'post' ), $field_data['type'], $field, $field_options, $pod, $params->id );

if ( null !== $value && '' !== $value && false !== $value ) {
$fields[ $field ]['value'] = $value;
Expand Down Expand Up @@ -6510,7 +6530,17 @@ public function duplicate_pod( $params, $strict = false ) {
while ( $this->load_pod( array( 'name' => $check_name ), false ) ) {
$try ++;

$check_name = $pod['name'] . $try;
$check_name_limited = $pod['name'];

if ( 'post_type' === $pod['type'] ) {
// Max length for post types are 20 characters, so let's limit it to that minus the strlen of $try.
$check_name_limited = substr( $$check_name_limited, 0, 20 - strlen( (string) $try ) );
} elseif ( 'taxonomy' === $pod['type'] ) {
// Max length for taxonomies are 32 characters, so let's limit it to that minus the strlen of $try.
$check_name_limited = substr( $$check_name_limited, 0, 32 - strlen( (string) $try ) );
}

$check_name = $check_name_limited . $try;
$new_label = $pod['label'] . $try;
}

Expand Down