What's the deal with Deno? We talk with a major contributor to find out. Listen now.

Questions tagged [elementquery]

The tag has no usage guidance.

13 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
2
votes
0answers
263 views

Group by Date Field in Element API Query

I have a custom field called releaseDate in one of my entry types. I would like to use Element API to get all the distinct years assigned to those entries. I dump all the years for all entries just ...
1
vote
1answer
114 views

How do I flush the query cache?

How do I flush Craft's query cache so that I may query a relationship field again in the same web request with a new set of parameters? In this particular scenario, I need to handle it inside of a ...
1
vote
0answers
69 views

Advanced queries with assets and other custom fields

To optimize performance, I'm trying to create an advanced entry query that selects only specific variables. I can set up the query to grab the entry title, uri, and a custom variable I created ("email"...
1
vote
0answers
64 views

What's the most performant way to get reverse related entries within an Element Query?

What's the most performant way to get reverse related entries within an Element Query? Here's a contrived example of this. I have thousands of "book" entries and thousands of "collection" entries. I ...
1
vote
0answers
52 views

Order entries by a matrix field category

I have a lot of trouble in understanding the database/model structure and how to work with the query builder. I tried playing a bit with leftJoins but i cannot seem to make complex queries in craft 3. ...
0
votes
0answers
15 views

Order by dynamic field in custom Element Type

In my module, I have a custom Element Type with three fields (firstName, lastName, email) that are dispalyed on an element index page in the CP. I have the first column as a full name by concating the ...
0
votes
0answers
17 views

Freeform: query form object for presence of field type (or other criterion)

I want to be able to check if a form object returned by a query has fields of a certain scope before I generate its markup. I have a test case where I want to know if a form has a checkbox field type ...
0
votes
0answers
31 views

How do you eager load or join reverse relationships for entries?

So I have structures that are related in the follwing way: Locations has many Providers Providers has many Health Topics I know that I can eager load all Locations with related Providers and Health ...
0
votes
0answers
29 views

Apply search filter in Element API

I have managed to build the search filter structure at the twig, but I get stuck when try to convert this structure in element API, {% if craft.request.getParam('query') %} {% set keyword = craft....
0
votes
0answers
19 views

Entry query in Twig setGlobals() not populating custom field data

I am using a custom Twig extension to add global variables: class MyGlobals extends \Twig_Extension implements \Twig_Extension_GlobalsInterface { public function getGlobals() { // This ...
0
votes
0answers
19 views

Front End get category group from uid

I have a form on the front end which has a category field. I want to display all the options from the category group, by obtaining the categories from the category group. When i dump the properties ...
0
votes
0answers
93 views

Custom Elements + Joins

I'm having a bit of trouble wrapping my head around an SQL issue with a custom Element. One column in my Element's table—for the case of this question, let's call it myplugin_things—has a foreign key ...
0
votes
0answers
41 views

How to add an Element sortOption to sort by number?

I have an Element. It's a Structure, with one level (not sure if that is relevant). I'd like to add a Sort Option that allows a user to sort the Element Index page for this Element by a number. The ...