Timeline for Element API display entries by category
Current License: CC BY-SA 3.0
6 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Feb 3, 2018 at 16:38 | comment | added | Robin Schambach |
Just to explain that: In Craft, there are elements (assets, users, categories, entries) every time you insert one of those 4 types a record in craft_elements is generated with some information about the record. When you insert an ID in the relatedTo it checks the record from craft_elements - in your case it will find a category in the type column - so it knows its a category and not an entry. That's the reason why you can relate everything with everything because there is one really huge table for all records
|
|
Feb 3, 2018 at 16:05 | comment | added | jamie | Works perfectly nice one Robin | |
Feb 3, 2018 at 16:05 | vote | accept | jamie | ||
Feb 3, 2018 at 16:00 | comment | added | jamie | Targeting by ID definitely seems to make more sense now that you mention that, so that 'relatedTo' => ['targetElement' => 5], how does that know that it is a category its going to be relating to? actually, that ID is going to be unique - silly me | |
Feb 3, 2018 at 15:58 | history | edited | Robin Schambach | CC BY-SA 3.0 |
added 540 characters in body; added 1 character in body
|
Feb 3, 2018 at 15:51 | history | answered | Robin Schambach | CC BY-SA 3.0 |