I am new to Cook and having a difficult time wrapping my head around this requirement.
The Setup:
1. A configuration admin view that sets the credentials to connect to a third party API.
2. A configuration admin view that defines the parameters for a call to the API. Multiple configurations can be added for making various call to the API
The Problem.
Admin view 2 has a few drop down fields whose values need to be set by an initial call to the API but I cannot figure out how to make that call and populate the drop down boxes.
Some Background
I have a content aggregation service that has a dashboard for managing content feeds from different websites. This dashboard allows you to set up groups of feeds, assign templates to those feed groups, and many other things.
In my Joomla component I am building, I need to get some of those dashboard settings using the service's API and allow the Joomla administrator to choose which of those settings to use.
For example, in the content aggregation service's dashboard, you can set up multiple templates for displaying content. Let's assume 3 templates were set up. Now when creating a new content feed action in Joomla, the component needs to offer the choice of which predefined content template to use. So a drop down labeled "Template" with the options [template1, template2, template3] is needed. But how do I populate it with the templates sent back form an API call to the content aggregation system?
It needs to do this in real time since templates and be added and deleted from the content aggregation service's dashboard at any time. I would be OK calling a process that dumps the response form the API call into a lookup table in the Joomla database and then populate the drop down from that table but I am not sure how to do that either.
I have attached what the admin configuration page I am trying to build looks like in a working wordpress plug-in. Look at the Template field as an example.
Here is the response from the API I need to use to populate the drop down:
{
resp: {
status: "OK",
code: 200,
data: {
totalAvailable: 1,
resultList: [
{
templateId: 735,
displayName: "Topic Page Template",
shortCode: "topicpage",
templateSections: [
{
sectionId: 900,
displayName: "Featured"
}
],
templateFields: [
{
displayName: "Placement",
shortCode: "placement",
type: "COMBOBOX",
required: false
},
{
displayName: "Description",
shortCode: "description",
type: "RTE",
required: false
},
{
displayName: "Equine Topic",
shortCode: "topic",
type: "TOPIC",
required: false
}
]
}
]
}
}
}