Hi I m using elementapi plugin to create an json object from my elements. I would like to get all entries, but not those ones who have a children.
My criteria it looks like this now
'elementType' => 'Entry',
'criteria' => ['section' => ['pages', 'home']],
'transformer' => function (EntryModel $entry) {
this returns all entries. For example I have one single home
and some other pages the result looks like this:
Home
About us <- this one has children
---------
test1
test2
test3
---------
Contact us
I would like to have result like this
Home
About us
Contact us
Is it possible to achieve this whit some criteria attribute. I've already tried to add level, like this
'criteria' => ['section'=>['pages','home'], 'level'=>'!=2' ]
not working
'criteria' => ['section'=>['pages','home'], 'level'=>1 ]
it's working but returns only pages not giving me the home section
I've tried hasChildren, hasDescendants none of this is working.
If someone can help, thank you in advance.