You are here

drupalgap.module in DrupalGap 6

A module to provide a bridge between Drupal websites and PhoneGap mobile applications.

File

drupalgap.module
View source
<?php

/**
 * @file
 * A module to provide a bridge between Drupal websites and PhoneGap mobile
 * applications.
 */

/**
 * Implements hook_perm().
 */
function drupalgap_perm() {
  return array(
    'administer drupalgap',
    'drupalgap get vocabularies',
    'drupalgap get terms',
  );
}

/**
 * Implements hook_menu().
 */
function drupalgap_menu() {
  $items = array();
  $items['admin/settings/drupalgap'] = array(
    'title' => 'DrupalGap',
    'description' => 'The status of DrupalGap.',
    'page callback' => 'drupalgap_status',
    'access arguments' => array(
      'administer drupalgap',
    ),
    'file' => 'drupalgap.pages.inc',
  );
  return $items;
}

/**
 * Implements hook_views_api().
 */
function drupalgap_views_api() {
  return array(
    'api' => 2,
    'path' => drupal_get_path('module', 'drupalgap'),
  );
}

/**
 * Implements hook_ctools_plugin_api().
 */
function drupalgap_ctools_plugin_api($owner, $api) {
  if ($owner == 'services' && $api == 'services') {
    return array(
      'version' => 3,
      'file' => 'drupalgap.services.inc',
    );
  }
}

/**
 * Implements hook_default_services_endpoint().
 */
function drupalgap_default_services_endpoint() {
  $endpoints = array();

  // Import the DrupalGap services endpoint.
  $endpoint = new stdClass();
  $endpoint->disabled = FALSE;

  /* Edit this to true to make a default endpoint disabled initially */
  $endpoint->api_version = 3;
  $endpoint->name = 'drupalgap';
  $endpoint->server = 'rest_server';
  $endpoint->path = 'drupalgap';
  $endpoint->authentication = array(
    'services' => 'services',
  );
  $endpoint->server_settings = array(
    'rest_server' => array(
      'formatters' => array(
        'json' => TRUE,
        'bencode' => FALSE,
        'jsonp' => FALSE,
        'php' => FALSE,
        'rss' => FALSE,
        'xml' => FALSE,
        'yaml' => FALSE,
      ),
      'parsers' => array(
        'application/json' => TRUE,
        'application/x-www-form-urlencoded' => TRUE,
        'multipart/form-data' => TRUE,
        'application/vnd.php.serialized' => FALSE,
        'application/x-yaml' => FALSE,
      ),
    ),
  );
  $endpoint->resources = array(
    'drupalgap_content' => array(
      'actions' => array(
        'content_types_list' => array(
          'enabled' => 1,
        ),
        'content_types_user_permissions' => array(
          'enabled' => 1,
        ),
      ),
    ),
    'drupalgap_system' => array(
      'actions' => array(
        'site_settings' => array(
          'enabled' => 1,
        ),
        'connect' => array(
          'enabled' => 1,
        ),
      ),
    ),
    'drupalgap_taxonomy' => array(
      'actions' => array(
        'get_vocabularies' => array(
          'enabled' => 1,
        ),
        'get_terms' => array(
          'enabled' => 1,
        ),
      ),
    ),
    'drupalgap_user' => array(
      'actions' => array(
        'access' => array(
          'enabled' => 1,
        ),
        'login' => array(
          'enabled' => 1,
        ),
        'logout' => array(
          'enabled' => 1,
        ),
        'register' => array(
          'enabled' => 1,
        ),
        'roles_and_permissions' => array(
          'enabled' => 1,
        ),
        'permissions' => array(
          'enabled' => 1,
        ),
      ),
    ),
    'comment' => array(
      'operations' => array(
        'create' => array(
          'enabled' => 1,
        ),
        'retrieve' => array(
          'enabled' => 1,
        ),
        'update' => array(
          'enabled' => 1,
        ),
        'delete' => array(
          'enabled' => 1,
        ),
      ),
    ),
    'file' => array(
      'operations' => array(
        'create' => array(
          'enabled' => 1,
        ),
        'retrieve' => array(
          'enabled' => 1,
        ),
      ),
    ),
    'node' => array(
      'operations' => array(
        'retrieve' => array(
          'enabled' => 1,
        ),
        'create' => array(
          'enabled' => 1,
        ),
        'update' => array(
          'enabled' => 1,
        ),
        'delete' => array(
          'enabled' => 1,
        ),
      ),
    ),
    'system' => array(
      'actions' => array(
        'connect' => array(
          'enabled' => 1,
        ),
        'get_variable' => array(
          'enabled' => 1,
        ),
        'set_variable' => array(
          'enabled' => 1,
        ),
        'del_variable' => array(
          'enabled' => 1,
        ),
      ),
    ),
    'taxonomy_term' => array(
      'operations' => array(
        'retrieve' => array(
          'enabled' => 1,
        ),
        'create' => array(
          'enabled' => 1,
        ),
        'update' => array(
          'enabled' => 1,
        ),
        'delete' => array(
          'enabled' => 1,
        ),
      ),
      'actions' => array(
        'selectNodes' => array(
          'enabled' => 1,
        ),
      ),
    ),
    'taxonomy_vocabulary' => array(
      'operations' => array(
        'retrieve' => array(
          'enabled' => 1,
        ),
        'create' => array(
          'enabled' => 1,
        ),
        'update' => array(
          'enabled' => 1,
        ),
        'delete' => array(
          'enabled' => 1,
        ),
      ),
      'actions' => array(
        'getTree' => array(
          'enabled' => 1,
        ),
      ),
    ),
    'user' => array(
      'operations' => array(
        'retrieve' => array(
          'enabled' => 1,
        ),
        'create' => array(
          'enabled' => 1,
        ),
        'update' => array(
          'enabled' => 1,
        ),
        'delete' => array(
          'enabled' => 1,
        ),
      ),
      'actions' => array(
        'login' => array(
          'enabled' => 1,
        ),
        'logout' => array(
          'enabled' => 1,
        ),
        'register' => array(
          'enabled' => 1,
        ),
      ),
    ),
  );
  $endpoint->debug = 0;
  $endpoints[] = $endpoint;
  return $endpoints;
}

Functions

Namesort descending Description
drupalgap_ctools_plugin_api Implements hook_ctools_plugin_api().
drupalgap_default_services_endpoint Implements hook_default_services_endpoint().
drupalgap_menu Implements hook_menu().
drupalgap_perm Implements hook_perm().
drupalgap_views_api Implements hook_views_api().