diff --git a/createapi.api.php b/createapi.api.php index cbff5b3..e6cba93 100644 --- a/createapi.api.php +++ b/createapi.api.php @@ -237,29 +237,3 @@ function hook_createapi_variables() { ); } -/** - * Alter the output of an entity before it's added to a feed. - * - * CreateAPI automatically will prepare fields, properties, and path information - * based on hook_createapi_custom_entities_info() and other related hooks that - * define feed information. For properties that aren't supported by CreateAPI or - * for properties that need additional modification, this hook may be used - * to add or modify information on an individual item's output. - * - * @param array $item - * The associative array containing the item that will be JSON encoded. - * @param stdClass $entity - * The entity for the item being output. - * - * @see _createapi__helper__process_entities() - */ -function hook_createapi_process_entity_alter(&$item, $entity) { - if (isset($item['type']) && $item['type'] == 'photo') { - // Remove HTML tags for app delivery. - $item['description'] = strip_tags($item['description']); - - // Check if this entity is flagged. - $flag = flag_get_flag('promoted'); - $item['promoted'] = $flag->is_flagged($entity->nid); - } -} diff --git a/createapi.helpers.filters.inc b/createapi.helpers.filters.inc index 2d3cfd4..09baa93 100644 --- a/createapi.helpers.filters.inc +++ b/createapi.helpers.filters.inc @@ -47,7 +47,7 @@ function _createapi__helper__filter__field(EntityFieldQuery &$query, $param, $co $query_params = drupal_get_query_parameters(); $param_value = (isset($query_params[$param])) ? $query_params[$param] : FALSE; - if ($param_value) { + if ($param_value !== FALSE) { $param_value_split = explode(',', $param_value); $query->fieldCondition($field, $column, $param_value_split, 'IN'); } diff --git a/createapi.helpers.inc b/createapi.helpers.inc index 5c4d0ad..79931bf 100644 --- a/createapi.helpers.inc +++ b/createapi.helpers.inc @@ -52,8 +52,6 @@ function _createapi__helper__process_entities(array $eids, $entity_type, $fields } } - drupal_alter('createapi_process_entity', $field_output, $entity); - $output[] = $field_output; } @@ -140,10 +138,38 @@ function _createapi__helper__feed_format_field($entity_type, $entity, $field_nam $output[] = $reference; break; + case 'field_collection': + $entity_id = $items[$i]['value']; + $referenced_entity = entity_load('field_collection_item', array($entity_id)); + $reference = array(); + if ($referenced_entity) { + $reference = array( + 'eid' => $entity_id , + ); + if (isset($current)) { + $referenced_entity = $referenced_entity[$entity_id]; + // Fields. + if (isset($current['fields'])) { + foreach ($current['fields'] as $key => $field) { + $reference[$key] = _createapi__helper__feed_format_field('field_collection_item', $referenced_entity, $field); + } + } + // Properties. + if (isset($current['properties'])) { + foreach ($current['properties'] as $key => $property) { + $reference[$key] = $referenced_entity->{$property}; + } + } + } + } + $output[] = $reference; + break; + case 'datetime': $output[] = strtotime($items[$i]['value']); break; case 'datestamp': + case 'time_of_day': $output[] = $items[$i]['value']; break; @@ -193,6 +219,10 @@ function _createapi__helper__feed_format_field($entity_type, $entity, $field_nam 'title' => (isset($items[$i]['title'])) ? $items[$i]['title'] : '', ); break; + case 'list_boolean': + case 'list_integer': + $output[] = (int) $items[$i]['value']; + break; } } } diff --git a/createapi.helpers.json.inc b/createapi.helpers.json.inc index 98dea5a..8676caf 100644 --- a/createapi.helpers.json.inc +++ b/createapi.helpers.json.inc @@ -21,7 +21,7 @@ function _createapi__helper__json_wrapper($rows, $wrapper_label, $row_label) { $output = array(); foreach ($rows as $row) { - $output[] = $row_label ? array($row_label => $row) : $row; + $output[] = array($row_label => $row); } $output = array($wrapper_label => $output); diff --git a/createapi.info b/createapi.info index 3c94cc2..3c98706 100644 --- a/createapi.info +++ b/createapi.info @@ -1,3 +1,7 @@ name = CreateAPI description = Create custom APIs core = 7.x +version = "7.x-1.x-dev" +core = "7.x" +project = "createapi" +datestamp = "1382157116"