You are here

system_service.module in Services 7

@author Services Dev Team

Link general system functionalities to services module.

File

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

/**
 * @author Services Dev Team
 * @file
 *  Link general system functionalities to services module.
 */

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

/**
 * Implementation of hook_perm().
 */
function system_service_perm() {
  return array(
    'send mail from remote',
    'get variable from remote',
    'set variable from remote',
    'check module exists from remote',
    'clear cache from remote',
  );
}

/**
 * Implementation of hook_service().
 */
function system_service_service() {
  return array(
    // system.connect
    array(
      '#method' => 'system.connect',
      '#callback' => 'system_service_connect',
      '#file' => array(
        'file' => 'inc',
        'module' => 'system_service',
      ),
      '#return' => 'struct',
      '#help' => t('Returns an object containing a sessid and user.'),
    ),
    // system.mail
    array(
      '#method' => 'system.mail',
      '#callback' => 'system_service_mailprepare',
      '#access arguments' => array(
        'send mail from remote',
      ),
      '#file' => array(
        'file' => 'inc',
        'module' => 'system_service',
      ),
      '#args' => array(
        array(
          '#name' => 'mailkey',
          '#type' => 'string',
          '#description' => t('A key to identify the mail sent, for altering.'),
        ),
        array(
          '#name' => 'to',
          '#type' => 'string',
          '#description' => t('The mail address or addresses where the message will be send to.'),
        ),
        array(
          '#name' => 'subject',
          '#type' => 'string',
          '#description' => t('Subject of the e-mail to be sent. This must not contain any newline characters, or the mail may not be sent properly.'),
        ),
        array(
          '#name' => 'body',
          '#type' => 'string',
          '#description' => t('Message to be sent. Drupal will format the correct line endings for you.'),
        ),
        array(
          '#name' => 'from',
          '#type' => 'string',
          '#optional' => TRUE,
          '#description' => t('Sets From, Reply-To, Return-Path and Error-To to this value, if given.'),
        ),
        array(
          '#name' => 'headers',
          '#type' => 'array',
          '#optional' => TRUE,
          '#description' => t('Associative array containing the headers to add. This is typically used to add extra headers (From, Cc, and Bcc).'),
        ),
      ),
      '#return' => 'struct',
      '#help' => t('Send an e-mail message, using Drupal variables and default settings.'),
    ),
    // system.getVariable
    array(
      '#method' => 'system.getVariable',
      '#callback' => 'system_service_getvariable',
      '#access arguments' => array(
        'get variable from remote',
      ),
      '#file' => array(
        'file' => 'inc',
        'module' => 'system_service',
      ),
      '#args' => array(
        array(
          '#name' => 'name',
          '#type' => 'string',
          '#description' => t('The name of the variable to return.'),
        ),
        array(
          '#name' => 'default',
          '#type' => 'string',
          '#optional' => TRUE,
          '#description' => t('The default value to use if this variable has never been set.'),
        ),
      ),
      '#return' => 'string',
      '#help' => t('Return a persistent variable.'),
    ),
    // system.setVariable
    array(
      '#method' => 'system.setVariable',
      '#callback' => 'system_service_setvariable',
      '#access arguments' => array(
        'set variable from remote',
      ),
      '#file' => array(
        'file' => 'inc',
        'module' => 'system_service',
      ),
      '#args' => array(
        array(
          '#name' => 'name',
          '#type' => 'string',
          '#description' => t('The name of the variable to set.'),
        ),
        array(
          '#name' => 'value',
          '#type' => 'string',
          '#description' => t('The value to set.'),
        ),
      ),
      '#help' => t('Set a persistent variable.'),
    ),
    // system.moduleExists
    array(
      '#method' => 'system.moduleExists',
      '#callback' => 'system_service_module_exists',
      '#access arguments' => array(
        'check module exists from remote',
      ),
      '#file' => array(
        'file' => 'inc',
        'module' => 'system_service',
      ),
      '#args' => array(
        array(
          '#name' => 'module',
          '#type' => 'string',
          '#description' => t('The name of the module.'),
        ),
      ),
      '#return' => 'string',
      '#help' => t('Check if a module is enabled. If so, return its version.'),
    ),
    // system.getServices
    array(
      '#method' => 'system.getServices',
      '#callback' => 'system_service_getservices',
      '#access arguments' => array(
        'get available services',
      ),
      '#file' => array(
        'file' => 'inc',
        'module' => 'system_service',
      ),
      '#return' => 'struct',
      '#help' => t('Returns an object containing all the available services.'),
    ),
    // system.cacheClearAll
    array(
      '#method' => 'system.cacheClearAll',
      '#callback' => 'system_service_cache_clear_all',
      '#access arguments' => array(
        'clear cache from remote',
      ),
      '#file' => array(
        'file' => 'inc',
        'module' => 'system_service',
      ),
      '#args' => array(),
      '#return' => 'bool',
      '#help' => t('Clear cache on remote site.'),
    ),
  );
}

Functions

Namesort descending Description
system_service_help Implementation of hook_help().
system_service_perm Implementation of hook_perm().
system_service_service Implementation of hook_service().