Closed ghost closed 7 years ago
I have VZ Address on my site and I'm trying to expose data stored in it via the Element API plugin. However, when I use the following endpoint config the address returned is "null":
'v1/locations/<entryId:\d+>.json' => function($entryId) { return [ 'elementType' => 'Entry', 'criteria' => ['id' => $entryId], 'first' => true, 'transformer' => function(EntryModel $entry) { return [ 'title' => $entry->title, 'url' => $entry->url, 'address' => $entry->address ]; }, ]; },
Try this:
'address' => $entry->address->toArray(),
I have VZ Address on my site and I'm trying to expose data stored in it via the Element API plugin. However, when I use the following endpoint config the address returned is "null":