Start change on Item metadata api
This commit is contained in:
parent
76f2d5d868
commit
30c51901f9
|
@ -87,10 +87,13 @@ class TAINACAN_REST_Item_Metadata_Controller extends TAINACAN_REST_Controller {
|
|||
public function prepare_item_for_response( $item, $request ) {
|
||||
$field_as = [];
|
||||
|
||||
foreach ( $item as $field ) {
|
||||
$field_as[] = $field->__toArray();
|
||||
foreach ( $item as $item_metadata ) {
|
||||
$field_as[] = $item_metadata->__toArray();
|
||||
//$field_as['field']['field_type_object'] = $item_metadata->get_field()->get_field_type_object()->__toArray();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return $field_as;
|
||||
}
|
||||
|
||||
|
|
|
@ -82,5 +82,17 @@ abstract class Field_Type {
|
|||
public function form(){
|
||||
|
||||
}
|
||||
|
||||
public function __toArray(){
|
||||
$attributes = [];
|
||||
|
||||
$attributes['className'] = get_class($this);
|
||||
$attributes['core'] = $this->core;
|
||||
$attributes['component'] = $this->get_component();
|
||||
$attributes['primitive_type'] = $this->get_primitive_type();
|
||||
|
||||
return $attributes;
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue