You are here

function views_service_service in Services 5

Same name and namespace in other branches
  1. 6 services/views_service/views_service.module \views_service_service()
  2. 6.2 services/views_service/views_service.module \views_service_service()
  3. 7 services/views_service/views_service.module \views_service_service()

Implementation of hook_service().

File

services/views_service/views_service.module, line 21
The module which exposes services related to views module

Code

function views_service_service() {
  return array(
    // views.getView
    array(
      '#method' => 'views.getView',
      '#callback' => 'views_service_get_view',
      '#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' => 'limit',
        '#type' => 'int',
        '#optional' => TRUE,
        '#description' => t('How many elements should be build by page'),
      ),
      array(
        '#name' => 'page',
        '#type' => 'int',
        '#optional' => TRUE,
        '#description' => t('If you use pager, which page to start'),
      ),
      array(
        '#name' => 'offset',
        '#type' => 'int',
        '#optional' => TRUE,
        '#description' => t('If pager is false, skip the first $offset results.'),
      ),
      array(
        '#name' => 'filters',
        '#type' => 'array',
        '#optional' => TRUE,
        '#description' => t('An array of exposed filter ops and values to use with the exposed filter system'),
      ),
      '#return' => 'array',
      '#help' => t('Retrieves a view defined in views.module.'),
    ),
    // views.exportView
    array(
      '#method' => 'views.exportView',
      '#callback' => 'views_service_export_view',
      '#access arguments' => array(
        'administer views',
      ),
      '#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.importView
    array(
      '#method' => 'views.importView',
      '#callback' => 'views_service_import_view',
      '#access arguments' => array(
        'administer views',
      ),
      '#args' => array(
        'string',
      ),
      '#args' => array(
        array(
          '#name' => 'view_export',
          '#type' => 'string',
          '#description' => t('Code from a Views->Export.'),
        ),
      ),
      '#return' => 'int',
      '#help' => t('Imports a view through code, equivalent to using the Import tab in the views admin.'),
    ),
  );
}