Timeline for How to display JSON returned (from external REST API) in a Block? [my code attempt inside]
Current License: CC BY-SA 3.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Nov 17, 2023 at 20:38 | history | edited | CommunityBot |
replaced http://us2.php.net with https://www.php.net
|
|
May 23, 2017 at 11:33 | history | edited | CommunityBot |
replaced http://stackoverflow.com/ with https://stackoverflow.com/
|
|
Nov 28, 2013 at 19:57 | vote | accept | drupalmav | ||
Nov 28, 2013 at 9:31 | history | edited | Mołot | CC BY-SA 3.0 |
added 115 characters in body
|
Nov 28, 2013 at 9:25 | comment | added | Mołot |
@drupalmav well it means your array has 2 sub-arrays and implode can't work on that directly. Imploding nested arrays was discussed on Stack Overflow already. For a '#theme' , pretty good example is in examples project I linked. You would need to write own theming function, but that's not so scary. Try and feel free to ask about details when you will have something (probably copied from examples and only modified to your needs ;) ).
|
|
Nov 28, 2013 at 9:22 | comment | added | drupalmav | @Mołot What can I use for '#theme' here? I tried the #1-implode option and the output just is "ArrayArray". (The json output can be seen at this link: api.kivaws.org/v1/loans/38239/lenders.json) Sorry if I am asking for a bit of hand holding here, been stuck on this for entire day. | |
Nov 28, 2013 at 9:16 | comment | added | Mołot | @Clive updated. Old problem with "but I know what I mean" on my part. | |
Nov 28, 2013 at 9:16 | history | edited | Mołot | CC BY-SA 3.0 |
added 275 characters in body
|
Nov 28, 2013 at 9:13 | comment | added | Clive♦ |
That's definitely true for best-practice - technically the content is passed through render() , so it can be a string. I suspect OP's current problem is that they're returning an array from kiva_list_loans() , and not formatting it into a render array, so render() throws a wobbly
|
|
Nov 28, 2013 at 9:10 | history | answered | Mołot | CC BY-SA 3.0 |