-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Add support for the format
property in query
#7314
base: trunk
Are you sure you want to change the base?
Commits on Sep 9, 2024
-
Add support for the
format
property in queryAdds handling the format property ($request['format'] ) in the class WP_REST_Posts_Controller. Adds handling the format property ($block->context['query']['format']) in the function build_query_vars_from_query_block.
Configuration menu - View commit details
-
Copy full SHA for 7b34ec9 - Browse repository at this point
Copy the full SHA 7b34ec9View commit details -
Tests: Add format as a valid parameter in WP_Test_REST_Posts_Controll…
…er::test_registered_query_params
Configuration menu - View commit details
-
Copy full SHA for 24efb21 - Browse repository at this point
Copy the full SHA 24efb21View commit details
Commits on Sep 11, 2024
-
build_query_vars_from_query_block: Fix incorrect variable name and br…
…oken logic In `build_query_vars_from_query_block`, the variable that contains the format attribute had the wrong name, which caused a PHP warning. The variable name was updated to `$formats`. One of the if-statements was closed incorrectly, which meant that all the logic for handling the format property was not used. Because of this, the wrong posts showed in the query loop block on the front of the site. The closing curly bracket for the if-statement was moved to solve this. One additional check was added to the wrapping if-statement: It now checks that `$block->context['query']['format']` is not empty, and is an array, before running the rest of the code.
Configuration menu - View commit details
-
Copy full SHA for 8e44597 - Browse repository at this point
Copy the full SHA 8e44597View commit details -
Tests: Update the qunit fixture in
wp-api-generated.js
Generated an updated fixture in `wp-api-generated.js` by running the PHPUnit tests. The update adds `format` to `mockedApiResponse.Schema`
Configuration menu - View commit details
-
Copy full SHA for d7ab338 - Browse repository at this point
Copy the full SHA d7ab338View commit details -
WP_REST_Posts_Controller
: remove redundant array conversion for the…… post formats. `WP_REST_Posts_Controller`: remove unnecessary array conversion for the `format` parameter. This addresses feedback that was left on the Gutenberg pull request.
Configuration menu - View commit details
-
Copy full SHA for a4fb1b4 - Browse repository at this point
Copy the full SHA a4fb1b4View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7eec23a - Browse repository at this point
Copy the full SHA 7eec23aView commit details -
WP_REST_Posts_Controller
get_collection_params
: adduniqueItems
…… to `$query_params['format']` In `WP_REST_Posts_Controller` `get_collection_params` class method; add `uniqueItems` to the `$query_params['format']` array. The purpose is to require all items in the array to be unique. This will help manage user errors, if duplicate items are passed in the `format` parameter. This change addresses feedback left on the Gutenberg pull request.
Configuration menu - View commit details
-
Copy full SHA for 83eefcb - Browse repository at this point
Copy the full SHA 83eefcbView commit details -
Tests: Update the qunit fixtures in wp-api-generated.js
Adds the regenerated fixtures which includes `uniqueItems` in the `format` array in `mockedApiResponse.Schema`. The fixture was regenerated by running the PHPUNit tests.
Configuration menu - View commit details
-
Copy full SHA for 5fb2c49 - Browse repository at this point
Copy the full SHA 5fb2c49View commit details
Commits on Sep 12, 2024
-
Update the format of inline comments
Use multiline comments instead of multiple single line comments.
Configuration menu - View commit details
-
Copy full SHA for 5058604 - Browse repository at this point
Copy the full SHA 5058604View commit details
Commits on Sep 17, 2024
-
Remove unnecessary
terms
from the query for the standard formatIn the `build_query_vars_from_query_block` function and the `WP_REST_Posts_Controller` class, a query with the `NOT EXISTS` operator is used to exclude all items that have a post format assigned. This commit removes a `terms` parameter from the two queries, because the terms are redundant when `NOT EXISTS` is used.
Configuration menu - View commit details
-
Copy full SHA for 1b974aa - Browse repository at this point
Copy the full SHA 1b974aaView commit details -
Change the
relation
fromOR
toAND
when querying for theformat
When querying for the `format` property in the `build_query_vars_from_query_block` function and the `WP_REST_Posts_Controller` class, the query may be combined with other taxonomy queries. For example, the user may expect the result to be posts with a specific format and a specific category. Previously, the `relation` parameter in the query was set to `OR`, which should return items that has either the format or the taxonomy. This commit changes the `relation` to `AND` with the intention to limit the result to items that have both the queried taxonomy and the format.
Configuration menu - View commit details
-
Copy full SHA for 3244361 - Browse repository at this point
Copy the full SHA 3244361View commit details -
In build_query_vars_from_query_block: validate the formats
Validate the that the `format` property passed to the query using the block context is either the default (standard) or a supported post format, registered with `add_theme_support()`. Compare `format` to the supported formats in `get_post_format_slugs()` and remove invalid formats.
Configuration menu - View commit details
-
Copy full SHA for 5ee2750 - Browse repository at this point
Copy the full SHA 5ee2750View commit details
Commits on Sep 19, 2024
-
WP_REST_Posts_Controller: Change the
relation
fromAND
toOR
wh……en querying for the `format` When querying for the `format` property in the `WP_REST_Posts_Controller` class, the `relation` parameter in the query was incorrectly set to `AND`. This commit changes the relation back to `OR`. This is needed because when a user queries for a combination of the `standard` post format and any other format, the result should include items with either the given format, or no format (standard). A post item can not have more than one format. The commit also renames the variable `$tax_query` to `$formats_query` to improve the readability.
Configuration menu - View commit details
-
Copy full SHA for c71f92f - Browse repository at this point
Copy the full SHA c71f92fView commit details -
build_query_vars_from_query_block: Change the
relation
when queryin……g for the `format` When querying for the `format` property in `build_query_vars_from_query_block`, the `relation` parameter in the query was incorrectly set to `AND`. This commit changes the relation back to `OR`. This is needed because when a user queries for a combination of the `standard` post format and any other format, the result should include items with either the given format, or no format (standard). A post item can not have more than one format. The commit also renames the variable `$tax_query` to `$formats_query` to improve the readability.
Configuration menu - View commit details
-
Copy full SHA for 19ba793 - Browse repository at this point
Copy the full SHA 19ba793View commit details -
Formats: address feedback from code review and PHPCS issues
This commit corrects inline docBlocks, removes unnecessary string concatenations, and tries to resolve a PHP coding standard issue about the formatting of an array.
Configuration menu - View commit details
-
Copy full SHA for ef44367 - Browse repository at this point
Copy the full SHA ef44367View commit details -
build_query_vars_from_query_block: Try to resolve the nested relations
When querying for formats, the relation between the format and other taxonomies like categoryíes and tags should be `AND`. The intention is to allow users to query for a post with a specific category and a specific format.
Configuration menu - View commit details
-
Copy full SHA for 47e1581 - Browse repository at this point
Copy the full SHA 47e1581View commit details
Commits on Sep 20, 2024
-
Configuration menu - View commit details
-
Copy full SHA for ad5ea9f - Browse repository at this point
Copy the full SHA ad5ea9fView commit details
Commits on Sep 23, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 0d3d4dc - Browse repository at this point
Copy the full SHA 0d3d4dcView commit details