You are here

taxonomy_service.module in Services 6.2

Link general taxonomy functionalities to services module.

File

services/taxonomy_service/taxonomy_service.module
View source
<?php

/**
 * @file
 *  Link general taxonomy functionalities to services module.
 */

/**
 * Implementation of hook_perm().
 */
function taxonomy_service_perm() {
  return array(
    'administer taxonomy from remote',
    'access taxonomy from remote',
  );
}

/**
 * Implementation of hook_service().
 */
function taxonomy_service_service() {
  return array(
    // Save a taxonomy term.
    array(
      '#method' => 'taxonomy.saveTerm',
      '#callback' => 'taxonomy_service_save_term',
      '#access arguments' => array(
        'administer taxonomy from remote',
      ),
      '#file' => array(
        'file' => 'inc',
        'module' => 'taxonomy_service',
      ),
      '#args' => array(
        array(
          '#name' => 'term',
          '#type' => 'array',
          '#description' => t('A taxonomy term array, as would be returned by taxonomy_get_term().'),
        ),
      ),
      '#return' => 'int',
      '#help' => t('Save / create a taxonomy term. See taxonomy_save_term() in Drupal API for details.'),
    ),
    // Save a taxonomy vocabulary.
    array(
      '#method' => 'taxonomy.saveVocabulary',
      '#callback' => 'taxonomy_service_save_vocabulary',
      '#access arguments' => array(
        'administer taxonomy from remote',
      ),
      '#file' => array(
        'file' => 'inc',
        'module' => 'taxonomy_service',
      ),
      '#args' => array(
        array(
          '#name' => 'vocabulary',
          '#type' => 'array',
          '#description' => t('A taxonomy vocabulary array, as would be returned by taxonomy_vocabulary_load().'),
        ),
      ),
      '#return' => 'int',
      '#help' => t('Save / create a taxonomy vocabulary. See taxonomy_save_vocabulary() in Drupal API for details.'),
    ),
    // Interface to taxonomy_get_tree().
    array(
      '#method' => 'taxonomy.getTree',
      '#callback' => 'taxonomy_service_get_tree',
      '#access arguments' => array(
        'access taxonomy from remote',
      ),
      '#file' => array(
        'file' => 'inc',
        'module' => 'taxonomy_service',
      ),
      '#args' => array(
        array(
          '#name' => 'vid',
          '#type' => 'int',
          '#description' => t('A vocabulary id.'),
        ),
        array(
          '#name' => 'parent',
          '#type' => 'int',
          '#description' => t('The term ID under which to generate the tree.'),
          '#optional' => TRUE,
        ),
        array(
          '#name' => 'max_depth',
          '#type' => 'int',
          '#description' => t('The number of levels of the tree to return.'),
          '#optional' => TRUE,
        ),
      ),
      '#return' => 'struct',
      '#help' => t('Create a hierarchical representation of a vocabulary.'),
    ),
    // Retrieve nodes based on taxonomy terms
    array(
      '#method' => 'taxonomy.selectNodes',
      '#callback' => 'taxonomy_service_select_nodes',
      '#access arguments' => array(
        'access taxonomy from remote',
      ),
      '#file' => array(
        'file' => 'inc',
        'module' => 'taxonomy_service',
      ),
      '#args' => array(
        array(
          '#name' => 'tids',
          '#type' => 'array',
          '#description' => t('An array of term IDs to match.'),
        ),
        array(
          '#name' => 'fields',
          '#type' => 'array',
          '#optional' => TRUE,
          '#description' => t('A list of fields to return.'),
        ),
        array(
          '#name' => 'operator',
          '#type' => 'string',
          '#optional' => TRUE,
          '#description' => t('How to interpret multiple IDs in the array. Can be "or" or "and".'),
        ),
        array(
          '#name' => 'depth',
          '#type' => 'string',
          '#optional' => TRUE,
          '#description' => t('How many levels deep to traverse the taxonomy tree. Can be a nonnegative integer or "all".'),
        ),
        array(
          '#name' => 'pager',
          '#type' => 'boolean',
          '#optional' => TRUE,
          '#description' => t('Whether the nodes are to be used with a pager (the case on most Drupal pages) or not (in an XML feed, for example).'),
        ),
        array(
          '#name' => 'order',
          '#type' => 'string',
          '#optional' => TRUE,
          '#description' => t('The order clause for the query that retrieve the nodes.'),
        ),
      ),
      '#return' => 'struct',
      '#help' => t('Finds all nodes that match selected taxonomy conditions.'),
    ),
  );
}

Functions

Namesort descending Description
taxonomy_service_perm Implementation of hook_perm().
taxonomy_service_service Implementation of hook_service().