views_service.module in Services 6
Same filename and directory in other branches
@author Services Dev Team
Link general views functionalities to services module.
File
services/views_service/views_service.moduleView source
<?php
/**
* @author Services Dev Team
* @file
* Link general views functionalities to services module.
*/
/**
* Implementation of hook_help().
*/
function views_service_help($path, $arg) {
switch ($path) {
case 'admin/help#services_views':
return t('<p>Provides view methods to services applications. Requires services.module.</p>');
case 'admin/modules#description':
return t('Provides view methods to services applications. Requires services.module.');
}
}
/**
* Implementation of hook_service().
*/
function views_service_service() {
return array(
// views.get
array(
'#method' => 'views.get',
'#callback' => 'views_service_get',
'#access callback' => 'views_service_get_access',
'#file' => array(
'file' => 'inc',
'module' => 'views_service',
),
'#key' => FALSE,
'#args' => array(
array(
'#name' => 'view_name',
'#type' => 'string',
'#description' => t('View name.'),
),
array(
'#name' => 'fields',
'#type' => 'array',
'#optional' => TRUE,
'#description' => t('A list of fields to return.'),
),
array(
'#name' => 'args',
'#type' => 'array',
'#optional' => TRUE,
'#description' => t('An array of arguments to pass to the view.'),
),
array(
'#name' => 'offset',
'#type' => 'int',
'#optional' => TRUE,
'#description' => t('An offset integer for paging.'),
),
array(
'#name' => 'limit',
'#type' => 'int',
'#optional' => TRUE,
'#description' => t('A limit integer for paging.'),
),
),
'#return' => 'array',
'#help' => t('Retrieves a view defined in views.module.'),
),
// views.export
array(
'#method' => 'views.export',
'#callback' => 'views_service_export',
'#access arguments' => array(
'administer views',
),
'#file' => array(
'file' => 'inc',
'module' => 'views_service',
),
'#args' => array(
'string',
),
'#args' => array(
array(
'#name' => 'view_name',
'#type' => 'string',
'#description' => t('View name.'),
),
),
'#return' => 'string',
'#help' => t('Exports the code of a view, same as the output you would get from the Export tab.'),
),
// views.import
array(
'#method' => 'views.import',
'#callback' => 'views_service_import',
'#access arguments' => array(
'administer views',
),
'#file' => array(
'file' => 'inc',
'module' => 'views_service',
),
'#args' => array(
array(
'#name' => 'view_import',
'#type' => 'string',
'#size' => 'big',
'#description' => t('Code from a Views->Export.'),
),
array(
'#name' => 'view_name',
'#type' => 'string',
'#optional' => TRUE,
'#description' => t('The new Views name.'),
),
),
'#return' => 'int',
'#help' => t('Imports a view through code, equivalent to using the Import tab in the views admin.'),
),
);
}
Functions
Name | Description |
---|---|
views_service_help | Implementation of hook_help(). |
views_service_service | Implementation of hook_service(). |