I have a select field that gets its values from a json file created by a route. It’s suddenly stopped working on a site i built a while back. When i load the page the progress bar takes ages to get across. PHP 7.1.
It’s 2.5.12. If i hit the json file directly in the browser, thats working fine, but for some reason the select fields are refusing to read it. The select is empty and it wont let me save the page.
Any idea?
The route looks like this…
array(
'pattern' => 'pagelist.json',
'action' => function() {
header('Content-type: application/json; charset=utf-8');
$pages = site()->index()->visible()->filterBy('template', 'not in', ['error', 'blogarticle']);
$json = array();
foreach ($pages as $page) {
$json[$page->autoid()->value()] = $page->title()->value();
echo json_encode($json);
}
),
And the blue print…
cblocklinkurl:
label: Button One Link
type: select
options: url
width: 1/2
help: The button link value
url: pagelist.json