From what I can tell you’re just trying to pull data from a TV and include it in the end point? If so then this should work for you. Just replace ‘tvname’ with the name of the TV you want to pull the data from.
<?php
class MyControllerResources extends modRestController {
public $classKey = 'modResource';
public $defaultSortField = 'id';
public $defaultSortDirection = 'ASC';
public function prepareListObject(xPDOObject $object){
$objectArray = $object->toArray();
$objectArray['fullUrl'] = $this->modx->makeUrl($objectArray['id'], "", "", "full");
$objectArray['locations'] = $this->object->getTVValue('tvname');
$objectArray['internationalLocations'] = $this->object->getTVValue('tvname');
return $objectArray;
}
}
return 'MyControllerResources';