Skip to content
distributor_service.module 2.46 KiB
Newer Older
Graham Taylor's avatar
Graham Taylor committed
<?php
// $Id$
/**
 * @author gtaylor
 * @file
 * Link general node distribution functionality to services module.
 */

/**
 * Implementation of hook_help().
 */
function disrtibutor_service_help($path, $arg) {
  switch ($path) {
    case 'admin/help#services_distributor':
      return '<p>'. t('Provides node distribution methods to services applications. Requires services.module.') .'</p>';
    case 'admin/modules#description':
      return t('Provides node distribution methods to services applications. Requires services.module.');
  }
}

/**
 * Implementation of hook_perm().
 */
function distributor_service_perm() {
  return array(
    'get any node distribution data', 
  );
}

/**
 * Implementation of hook_service().
 */
function distributor_service_service() {
  return array(

    // node.getType
    array(
      '#method'           => 'node.getType',
      '#callback'         => 'distributor_service_get_type',
      '#access callback'  => 'distributor_service_get_access',
      '#file'             => array('file' => 'inc', 'module' => 'distributor_service'),
      '#args'             => array(
        array(
          '#name'           => 'type',
          '#type'           => 'string',
          '#description'    => t('A node type.')
        ),
      ),
      '#return'           => 'boolean',
      '#help'             => t('Returns a boolean.')
    ),

    // node.getAllTypes
    array(
      '#method'           => 'node.getAllTypes',
      '#callback'         => 'distributor_service_get_all_types',
      '#access callback'  => 'distributor_service_get_access',
      '#file'             => array('file' => 'inc', 'module' => 'distributor_service'),
      '#args'             => array(),      
      '#return'           => 'array',
      '#help'             => t('Obtain whether or not nodes are flagged as distributable pieces of content.')
    ),
        
    // node.deleteDistributedNode
    array(
      '#method'           => 'node.deleteDistributedNode',
      '#callback'         => 'distributor_service_delete_node',
      '#access callback'  => 'distributor_service_get_access',
      '#file'             => array('file' => 'inc', 'module' => 'distributor_service'),
      '#args'             => array(
        array(
          '#name'           => 'nid',
          '#type'           => 'int',
          '#description'    => t('A node id.')
        ),
      ),      
      '#return'           => 'boolean',
      '#help'             => t('Returns a boolean.')),		
    ); 
}