Hi there. I’m building a a site to render statistical graphs using ACF blocks. An example of the graph below.
Each of the blocks gets the statistics data from an API call, and the API URL is unique to each block. For selecting the data dimension to be used as X- and Y-axis of the graph, I have used select fields (with stylized UI and AJAX lazy-load). The dimensions vary for each graph (depend on the API response). Thus, I would need to make an API call first, and the populate the select field choices based on the response.
Now, I’m not sure how to properly utilize the load_value filter to populate the choices. I found examples using load_field filter, but using that filter, the ACF block’s settings — block’s unique ID in particular — are not (yet) fully available. I can only get the field key, but that is same for all the block instances. Thus I cannot get the unique API URL for making the API call.
Are the any examples using load_value filter for ACF block select field choices, or should I pursue some other kind of solution?
– – – –
Some background info on the project; the data comes from Statistics Finland‘s PxWeb API. With the PxWeb interface, you can create saved queries towards the data. Each saved query will be assigned a unique API URL you can refer to. I’m requesting the data in JSON-stat format and rendering the graphs using HighCharts library.