Advertisement
tcbarrett

Make OB from Podio item ob

Jan 6th, 2012
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.50 KB | None | 0 0
  1. function make_podio_item_ob( $item ){
  2.   $ob = (object)array(
  3.     'id'      => $item['item_id'],
  4.     'item_id' => $item['item_id'],
  5.   );
  6.  
  7.   $fields = array();
  8.   foreach( $item['fields'] as $field ){
  9.     $id     = $field['field_id'];
  10.     $slug   = $field['external_id'];
  11.     $label  = $field['label'];
  12.     $values = $field['values'];
  13.     $fields[$slug] = (object)array(
  14.       'id'     => $id,
  15.       'label'  => $label,
  16.       'values' => $values
  17.     );
  18.   }
  19.  
  20.   $ob->fields = $fields;
  21.   return $ob;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement