I am fighting since days with this situation:

I have a Select field with around 150 item and depending on a selected item a list of icons and names should be shown (around 50). The list of items (names and an url for an icon) comes from an API.

I am calling this API withing the variable component of a plugin. I have to do it with PHP, AJAX API call is not possible in my case. So right now I am putting the whole content in a string and spitting that string out in twig. Resulting in a 37,6 MB document. So this is not the solution...

My thought is now to return an array of the API in my variable component and grab just the DATA I need on the change event of the select field.

Is that possible? Can I use the include statement of twig with AJAX? Or grab data from the variable in the plugin with JS?

I am really not getting forward with this and it's driving me mad !

  • Do I understand correctly and your API returns ~40 MB worth of text? – carlcs Aug 29 '17 at 22:39
  • No, just the string I returned in the variable component was that big. But as I thought, this was nonsense, just to picture the desperateness of my situation. However I found a better way now. Will post an answer soon. – Jan Aug 30 '17 at 9:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.