Please sign in to comment.
MDL-31789: Allowing context object to be passed to JS using json_enco…
…de() Classes with magic properties such as context do not pass through json_encode(). The solution is to implement iterator in such classes and convert what we feed to json_encode to array using 'foreach' before we pass it to json_encode(): - class context implements IteratorAggregate - added function convert_to_array() that converts anything to array - before calling json_encode we convert the argument to array
- Loading branch information...
Showing with 58 additions and 5 deletions.