You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a site with a Matrix Block field whose ID is 262. Each Type in this field has a subfield with the handle menuText. I'm looking for all Matrix Blocks in that field belonging to the current entry whose menuText field is not empty.
I can return results if either the fieldId parameter or a search parameter is used in the matrixBlocks query. However, I cannot return results if both parameters are used. Additionally, using any kind of search seems to return all the blocks, rather than actually applying that search.
For reference, here's my query. The variable page is defined in the loop in which this query exists. {% set matchingBlocks = craft.matrixBlocks.owner(page).fieldId(262).menuText('*').all() %}
Also note that, for the search parameter, I've tried many variations with either all results or no results. Some variations I've tried include:
Finally, I've ensured that the setting "Use this field’s values as search keywords" is on for the Matrix field itself and for the menuText subfield.
My main concern here is that fieldId and search don't seem to work together, as I need to specify fieldId in order to access the custom field content of the results, according to the docs. Without being able to combine these parameters, I won't be able to search for the matching blocks and return the contents of those matches with the same query.
Steps to reproduce
Create a matrix field with several block types, each containing a subfield of the same name
In the template, write a matrixBlocks query to search for matches in the subfield, using fieldId
Additional info
Craft version: 3.7.7
PHP version: 7.3.7
The text was updated successfully, but these errors were encountered:
Thanks for reporting that! Not really sure how we’ve made it this far without anyone noticing, but apparently we never added support for fieldHandle:keyword search syntax for Matrix block queries.
I’ve just fixed that for the next release. To get the fix early, change your craftcms/cms requirement in composer.json to "dev-develop as 3.7.7" and run composer update.
Description
I have a site with a Matrix Block field whose ID is 262. Each Type in this field has a subfield with the handle
menuText
. I'm looking for all Matrix Blocks in that field belonging to the current entry whosemenuText
field is not empty.I can return results if either the
fieldId
parameter or a search parameter is used in thematrixBlocks
query. However, I cannot return results if both parameters are used. Additionally, using any kind of search seems to return all the blocks, rather than actually applying that search.For reference, here's my query. The variable
page
is defined in the loop in which this query exists.{% set matchingBlocks = craft.matrixBlocks.owner(page).fieldId(262).menuText('*').all() %}
Also note that, for the search parameter, I've tried many variations with either all results or no results. Some variations I've tried include:
Finally, I've ensured that the setting "Use this field’s values as search keywords" is on for the Matrix field itself and for the
menuText
subfield.My main concern here is that
fieldId
andsearch
don't seem to work together, as I need to specifyfieldId
in order to access the custom field content of the results, according to the docs. Without being able to combine these parameters, I won't be able to search for the matching blocks and return the contents of those matches with the same query.Steps to reproduce
fieldId
Additional info
The text was updated successfully, but these errors were encountered: