You are here

function _taxonomy_vocabulary_resource_index in Services 7.3

Same name and namespace in other branches
  1. 6.3 resources/taxonomy_resource.inc \_taxonomy_vocabulary_resource_index()

Return an array of optionally paged vids based on a set of criteria.

An example request might look like

http://domain/endpoint/taxonomy_vocabulary?fields=vid,name&parameters[vi...

This would return an array of objects with only vid and name defined, where vid = 2.

@todo Support node types as parameters.

Parameters

$page: Page number of results to return (in pages of 20).

$fields: The fields you want returned.

$parameters: An array containing fields and values used to build a sql WHERE clause indicating items to retrieve.

$page_size: Integer number of items to be returned.

$options: Additional query options.

Return value

An array of vocabulary objects.

See also

_node_resource_index() for more notes

1 string reference to '_taxonomy_vocabulary_resource_index'
_taxonomy_resource_definition in resources/taxonomy_resource.inc
@file Link general taxonomy functionalities to services module.

File

resources/taxonomy_resource.inc, line 697
Link general taxonomy functionalities to services module.

Code

function _taxonomy_vocabulary_resource_index($page, $fields, $parameters, $page_size, $options = array()) {
  $taxonomy_select = db_select('taxonomy_vocabulary', 't');
  services_resource_build_index_query($taxonomy_select, $page, $fields, $parameters, $page_size, 'taxonomy_vocabulary', $options);
  $results = $taxonomy_select
    ->execute();
  return services_resource_build_index_list($results, 'taxonomy_vocabulary', 'vid');
}