wsbeans_default_json_form.processor.inc in Web Service Data 7
File
modules/wsbeans/wsbeans_default_json_form.processor.inc
View source
<?php
class wsbeans_default_json_form extends wsdata_simple_json_processor {
public function parse($data) {
$data = parent::parse($data);
$list = $this
->sublist('', $data);
$form = array(
'#theme' => 'item_list',
'#items' => $list['children'],
'#type' => 'ul',
);
return $form;
}
private function sublist($key, $data) {
$list = array();
if (is_array($data)) {
$list = array();
foreach ($data as $key => $val) {
$list[$key] = $this
->sublist($key, $val);
}
return array(
'children' => $list,
);
}
return $key . ': ' . $data;
}
}