'api/looks/list' => [
'criteria' => ['section' => 'looks'],
'transformer' => function(EntryModel $entry) {
//print_r($entry->getAncestors());
// $model = $entry->content->attributeConfigs["featuredImage"]["model"];
// echo 'class type: ' . get_class($model);
// print_r($model);
return [
'title' => $entry->title,
'id' => $entry->id,
'url' => $entry->url,
'jsonUrl' => UrlHelper::getUrl("looks/{$entry->id}.json"),
'kachelgroesse' => $entry->kachelgroesse,
'category' => $entry->category,
'image' => $entry->image
];
},
],
This is my elementapi.php
file and it returns:
{
"data": [
{
"title": "SHINY AND RED LIPS",
"id": "281",
"url": "http://craft.dev:8888/looks/shiny-and-red-lips",
"jsonUrl": "http://craft.dev:8888/looks/281.json",
"kachelgroesse": {
"0": {
"label": "mittel",
"value": "mittel",
"selected": true
}
},
"category": {
"0": {
"label": "Make-Up",
"value": "Make-Up",
"selected": true
}
},
"image": {}
}
],
}
There is no image returning. I am requesting the list of all entries and their image/asset location from the API.