Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Matrix fields allow you to create multiple blocks of content within a single field.
1
vote
If Most Recent Instance of a Block Contains X in Y Field Then Do Z
My answer is based on the assumption you only have one matrix module you want to compare, otherwise you would have to store your values in an array with the key as block.getType().handle or you would have …
3
votes
Accepted
Get the handle of a Matrix block
You can grab the handle of an element that has different types (entries, matrix) with getType()->handle for example:
$handle = $entry->getType()->handle
In your case
$criteria = craft()->elements-> …
1
vote
How can I filter by Matrix field
You can query Matrix blocks like you are used to with all other elements
{% set blocks = element.matrixFieldHandle.type('typeHandle').field('some value').all() %}
Keep in mind your field should be a …
1
vote
Searching Matrix field
As far as I know (please correct me if I missed something) you can only search for the entire matrix by matrixField:value and not certain fields within your matrix since the table searchindexes only contains … the id of the matrix field itself, not the id of the field inside the matrix. …
5
votes
Accepted
Loop through matrix field find first block of a type
{% set myFirstMatrixBlockWithType = entry.blogPostMainSection.type('blogText').one() %}
{{ myFirstMatrixBlockWithType.articleText }}
Keep in mind entry.blogPostMainSection is not an array of block …
2
votes
Accepted
Check if a value exists in a Matrix field
You can check if certain elements match for your Query via exists()
entry.floors.type('floor').floorNumber(1).exists()
returns true or false. However keep in mind entry.floors returns an element of …
1
vote
Show all entries from an entry field
The elementCriteriaModel is a class/object that handles your search. It's a class that combines multiple methods to fetch entries from your database with an iterable interface on it.
That means: when …
1
vote
Eager-loading of matrix field with getPage
Update after Brad's comment since the with part seems to be ok - by the way thank you, it is another good example that you never stop learning.
I never saw that with attribute in a ElementCriteriaMod …
2
votes
Get the three last Matrix blocks
You can fetch all elements and slice the last 3 elements from them
{% set entriesList = entry.fieldHandle.find() %}
{% set start = entriesList|length - 3 %}
{% set end = entriesList|length %}
{% set …
1
vote
Accepted
How to Show the Total Word Count of an Entry?
What you want to achieve is not an easy task because you would have to hook into many different events to recognize new blocktypes.
The fastest and easiest method would be to use this plugin as the b …
2
votes
Accepted
How to rearrange the order of blocks of a single matrix field using a frontend form?
Your sort order will change according to your HTML, so when you change your html, the sort order will change. You can use certain Javascript libraries to move your containers in your DOM, when you sav …
2
votes
Accepted
call matrix entries
In order to get all elements from an ElementCriteriaModel you need to call the find() function
{% set form = craft.entries({section: 'registration'}).find() %}
You can them access those with normal …
2
votes
Accepted
Matrix Field Count Records
{{ matrixblock.superTableFieldHandle|length }}
Or the number of blocks of a matrix field? …
2
votes
Accepted
Matrix field not displaying all blocks on Craft 3 Upgrade
If you manipulate your query somewhere else in the code those properties will not reset after you execute it. You'll either reset the properties (for example query.typeId(null).all() or you need the c …
1
vote
Accepted
Entries Field Type showing all entries instead of entries selected
You need to use the relatedTo parameter
{% for entry in craft.entries.relatedTo(block).section('sessionTiles').all() %}
or even more simple the short syntax
{% for sessionTile in block.blockTilesC …