Hi, is there an easier way to grab all regions of a page using the Headless API, rather than adding them all to a set?
The following doesn't work but shows what I'm after:
Code
- $Headless = $API->get('HeadlessAPI');$Response = $Headless->new_response();
- $Regions = $API->get('ContentRegions');
- $Set = $Headless->new_set('regions');
- $Set->add_items($Regions->query(['page' => '/about-page',]));
- $Response->add_set($Regions);
- if ($Set->length == 0) {$Response->set_status('empty'); // HTTP 204}
- $Response->respond();
It works doing the following but isn't as futureproof as I'll have to add it into the API each time if I add a region:
Thanks.