/**
  * Overrides \RestfulEntityBaseNode::publicFieldsInfo().
  */
 public function publicFieldsInfo()
 {
     $public_fields = parent::publicFieldsInfo();
     $public_fields['body'] = array('property' => 'c4m_body', 'sub_property' => 'value');
     $public_fields['group'] = array('property' => OG_AUDIENCE_FIELD, 'resource' => array('group' => array('name' => 'groups', 'full_view' => FALSE)));
     $public_fields['discussion_type'] = array('property' => 'c4m_discussion_type');
     $public_fields['related_document'] = array('property' => 'c4m_related_document', 'resource' => array('document' => array('name' => 'documents', 'full_view' => FALSE)));
     $public_fields['topic'] = array('property' => 'c4m_vocab_topic', 'resource' => array('c4m_vocab_topic' => array('name' => 'topics', 'full_view' => FALSE)));
     $public_fields['categories'] = array('property' => 'og_vocabulary', 'resource' => array('categories' => array('name' => 'categories', 'full_view' => FALSE)));
     $public_fields['date'] = array('property' => 'c4m_vocab_date', 'resource' => array('c4m_vocab_date' => array('name' => 'dates', 'full_view' => FALSE)));
     $public_fields['language'] = array('property' => 'c4m_vocab_language', 'resource' => array('c4m_vocab_language' => array('name' => 'languages', 'full_view' => FALSE)));
     $public_fields['geo'] = array('property' => 'c4m_vocab_geo', 'resource' => array('c4m_vocab_geo' => array('name' => 'geo', 'full_view' => FALSE)));
     $public_fields['status'] = array('property' => 'status');
     return $public_fields;
 }
 /**
  * Overrides /ResfulEntityBase::createEntity().
  *
  * Add a new location when saving an event entity.
  */
 public function createEntity()
 {
     $entity = parent::createEntity();
     $request = $this->getRequest();
     $entity = node_load($entity[0]['id']);
     $locations = array(0 => array('address' => $request['location']['street'] . ' ' . $request['location']['postal_code'] . ', ' . $request['location']['city'] . ', ' . $request['location']['country_name'], 'street' => $request['location']['street'], 'postal_code' => $request['location']['postal_code'], 'city' => $request['location']['city'], 'country_name' => $request['location']['country_name'], 'country' => $request['location']['country'], 'latitude' => $request['location']['lat'], 'longitude' => $request['location']['lng'], 'name' => $request['location']['location_name']));
     $criteria = array('field_name' => 'c4m_location', 'nid' => $entity->nid, 'vid' => $entity->vid);
     $locations = getlocations_fields_save_locations($locations, $criteria, array(), 'insert');
     if (count($locations) > 0) {
         entity_metadata_wrapper('node', $entity)->c4m_location->set($locations[0]);
         node_save($entity);
     }
     $wrapper = entity_metadata_wrapper($this->entityType, $entity);
     return array($this->viewEntity($wrapper->getIdentifier()));
 }
 /**
  * Overrides \RestfulEntityBaseNode::publicFieldsInfo().
  */
 public function publicFieldsInfo()
 {
     $public_fields = parent::publicFieldsInfo();
     $public_fields['document'] = array('property' => 'c4m_document', 'process_callbacks' => array(array($this, 'processDocument')));
     $public_fields['body'] = array('property' => 'c4m_body', 'sub_property' => 'value');
     $public_fields['group'] = array('property' => OG_AUDIENCE_FIELD, 'resource' => array('group' => array('name' => 'groups', 'full_view' => FALSE)));
     $public_fields['document_type'] = array('property' => 'c4m_vocab_document_type', 'resource' => array('c4m_vocab_document_type' => array('name' => 'document_types', 'full_view' => FALSE)));
     $public_fields['categories'] = array('property' => 'og_vocabulary', 'resource' => array('categories' => array('name' => 'categories', 'full_view' => FALSE)));
     $public_fields['topic'] = array('property' => 'c4m_vocab_topic', 'resource' => array('c4m_vocab_topic' => array('name' => 'topics', 'full_view' => FALSE)));
     $public_fields['date'] = array('property' => 'c4m_vocab_date', 'resource' => array('c4m_vocab_date' => array('name' => 'dates', 'full_view' => FALSE)));
     $public_fields['language'] = array('property' => 'c4m_vocab_language', 'resource' => array('c4m_vocab_language' => array('name' => 'languages', 'full_view' => FALSE)));
     $public_fields['geo'] = array('property' => 'c4m_vocab_geo', 'resource' => array('c4m_vocab_geo' => array('name' => 'geo', 'full_view' => FALSE)));
     $public_fields['status'] = array('property' => 'status');
     $public_fields['add_to_library'] = array('property' => 'c4m_document_add_to_library');
     return $public_fields;
 }