Skip to main content

Unanswered Questions

31 questions with no upvoted or accepted answers
4 votes
0 answers
878 views

How to handle Craft 3 events in a plugin? Element API is returning null data

The below refers to Craft 3 and the Element API plugin for Craft 3. I would like to do something when the Element API plugin fires its onBeforeSendData event, I can see in the controller for element ...
3 votes
0 answers
302 views

Getting related entries along with entry using the Element API plugin

I want to list all the related entries to the entry I am displaying using the Element API plugin. I have a channel called series and another called episodes, the episodes have a relationship with 1 ...
3 votes
0 answers
515 views

How can I use the ElementAPI to get related entries based on two parameters?

I can successfully get entries related the "normal" way, but my list of possible results are getting quite large. Currently I am returning html mixed in with the data. It's obvious I need to get just ...
2 votes
0 answers
462 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 ...
2 votes
0 answers
262 views

Get field type of product or variant with element api

Trying to get type of a field (dropdown, checkbox, etc) to render those fields in app, there is all sorts of info available in $variant->fieldLayout->fields like handles, values, ids except type ...
2 votes
0 answers
791 views

Ordering Element API by Category and Title

I'm looking for a way to order the ElementAPI json array by category and title. I can only get one to work whether it's 'group' => 'stockistRegion.first().title' or 'order' => 'title' using the ...
1 vote
0 answers
127 views

Element API relatedTo not working

I'm creating a lazy load/infinite scroll based on the tutorial but I want it to grab entries that are in categories. It doesn't seem to be doing anything with it at all though. It's returning the list ...
1 vote
0 answers
100 views

Join multiple tables in element-api

My problem is the following: I have a website with products which contains ratings. I have an element-api endpoint to get the products. I want to sort the products based on the average rating or the ...
1 vote
0 answers
128 views

Migrating to Matrix using Feed Me and Element API

How can I use Element API to move my entry fields into a matrix-based content builder? I'm going off the docs found at https://docs.craftcms.com/feed-me/v4/guides/importing-into-matrix.html#setup-your-...
1 vote
0 answers
379 views

How to get an Entry in structure and all of its children and it's children's children with Element APi?

How do I get all of an entry's children using the Element API? I want to return something like: data: [ title: 'Root Entry' uri: 'root-entry' children: [ { title: '...
1 vote
0 answers
29 views

Locales with independent language and country

How might we use Craft to manage our locales, keeping our language and country logic independent? The desired scenario: No duplicate language entries: Spanish in Spain would be the same as Spanish in ...
1 vote
0 answers
42 views

Query element api (output) via plugin

Is there a way to fetch the content generated by the Element API via a plugin. For example, if we have created an ingredients/<slug:{slug}>.json endpoint, can the data for a specific page (eg ...
1 vote
0 answers
207 views

element-api: include a collection with mixed entry types, and nested includes

Does anyone know how to include a collection of entries, containing multiple entry-type, in such way that: 1. Each entry type gets transformed by its own custom transformer class (tailord to the ...
1 vote
0 answers
61 views

Retrieving Entries by Category & Exclude by Tag

I have an endpoint that I want to retrieve entries by a category, but then exclude entry ids if they have a certain tag. It seems to me that the relatedTo param overrides the id param that says not in ...
1 vote
0 answers
599 views

Element API SearchQuery to search for value inside child-entries

I currently try to use the Element API to build a search. Unfortunately I'm kind of stuck. I have a baseEntry, that has a field that references entries (let's call them subEntries) of the section ...

15 30 50 per page