Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

The tag has no usage guidance.

1
vote
1answer
24 views

Joining sections (Channel) to query based on a related item attribute

I've been trying this for a while now, so might have read this before. Sorry about that, I'm struggling really hard to get this right. At first I tried (wrongly) with the eager load features. I have ...
2
votes
1answer
19 views

How to get the unverifiedEmail value of a user after a change email request?

The currentUser.unverifiedEmail variable, which is public, is always empty on front end even after email change. I thought it was a bug. I contacted Craft support about this, and here is Brad's ...
2
votes
1answer
10 views

What is the correct syntax for using merge to create an array of field values from an element query?

I grab some values via an element query: {% set events = craft.entries.section('events').status('live,pending').order('postDate asc') %} But I need to put them into an array for use in a Craft-...
2
votes
1answer
44 views

Craft 3 - Searching by date field - Calling unknown method: craft\behaviors\ElementQueryBehavior

On a website upgraded to Craft 3 - having issues pulling events by date. Error Is: Calling unknown method: craft\behaviors\ElementQueryBehavior::eventDate() The Error occurs on the last line of my ...
1
vote
0answers
25 views

How do you query entries by field value for multi-select field type? [duplicate]

I am looking to query entries by a field value. The value will be a dynamic variable but i cannot get any results showing with hardcoded state. This is the code i have so far: $entries = Entry::...
1
vote
2answers
40 views

Element Query matrixfields where

I'm trying to query entries in a section where the (activities) entry has an item in a matrix field timeSlots -> timeSlot -> startDate. The startDate must be >= NOW(). $query = Entry::find()->...
1
vote
1answer
105 views

Craft query Matrix blocks in twig

Is it possible to query elements of type MatrixBlock in Twig like other elements? You can get entries with {% set entries = craft.entries.all() %} Is there something similar available for Matrix ...
1
vote
1answer
73 views

Craft 3 - Programatically get all the values contained in a field of type category

I want to programmatically get all the values contained in a field of type category. I am doing this on Elements::EVENT_AFTER_SAVE_ELEMENT. If I dump $event->element->getFieldValue('...
1
vote
1answer
48 views

Difference between chained and batch element queries?

I apologize if this has been asked or addressed already, but I have a question concerning Element Queries. The docs show two possible ways: Chained Methods {% set query = craft.entries() ....
1
vote
1answer
26 views

How to get entries with or

it is possible to do like this: $users = Entry::find() ->userLevel('>3') ->or group('admin') So in database level,the sql will go like this: select * from users where users.userLevel ...
1
vote
1answer
42 views

How to create an element query in PHP with custom field names in variables?

I'm trying to dynamically create an element query in PHP where the custom field criteria come from an array of strings. Something like this...? $users = User::find(); $users->group($groupList); ...
0
votes
1answer
39 views

Twig: length giving 1 on empty array?

This code worked fine in Craft 2: {% set entries = craft.entries.section('events').relatedTo(category).orderBy('startDate asc').limit(3) %} {% set extraEntries = craft.entries.section('events')....
1
vote
1answer
29 views

How can I filter a for loop based on the value of a field?

How can I filter a for loop based on the value of a field? I tried filterByValue, but I do not know how to construct the statement. This is NOT a category field. I have this... {% for line in ...
3
votes
1answer
45 views

How do you limit the number of items that show up in a navigation?

I have a nav set up which works find but I need to limit the number of top level links to the first 5 in the loop (right now we have 9 plus oodles of children links!). Have tried various flavours of ...
0
votes
0answers
35 views

Reverse RelatedTo Super Table in Matrix

Anyway to do this using Super Table? I have it working for Matrix fields but prefer Super Table because of the layout. I have tried this in Super Table but receive no elements. I have Matrix field ...
1
vote
1answer
70 views

Craft 3 entries “before” not working

I have a Craft 3 site. For some reason the before filter isn't working when pulling entries from a channel, but after does. This is not a data issue. {% set start = "2 months ago"|date() %} {% set ...