Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- halp.info:
- name = 'Halp me with targeted actionz!'
- description = I can't get it to work!
- core = 7.x
- dependencies[] = services
- dependencies[] = rest_server
- */
- function halp_services_resources() {
- fpc("halp_services_resources");
- $services_resources = array();
- $resource = array(
- 'retrieve' => array(
- 'help' => "Retrieve object",
- 'file' => array('file' => 'module', 'module' => 'halp', 'name' => "halp"),
- 'callback' => '_halp_retrieve',
- //'access callback' => '_halp_resource_access',
- //'access arguments' => array('view'),
- 'access arguments' => array('access content'),
- //'access arguments append' => TRUE,
- 'args' => array(
- array(
- 'name' => 'gid',
- 'type' => 'int',
- 'description' => 'The object id',
- 'source' => array('path' => 0),
- ),
- ),
- ),
- 'targeted_actions' => array(
- 'halp_me' => array(
- 'access callback' => '_halp_resource_access',
- 'access arguments' => array('access content'),
- 'access arguments append' => TRUE, // Users should only have access to their own
- 'callback' => '_halp_targeted_action_halp_me',
- 'description' => 'asdf!',
- 'args' => array(
- 'name' => 'gid',
- 'optional' => FALSE,
- 'source' => array('path' => 0),
- 'type' => 'int',
- 'description' => t('object id'),
- ),
- ),
- ),
- );
- $services_resources['halp'] = $resource;
- return $services_resources;
- }
- function _halp_targeted_action_halp_me($action, $gid) {
- return array("<halp_me>worked</halp_me>");
- }
- function _halp_resource_access($arg1) {
- return TRUE;
- }
- function _halp_retrieve($gid) {
- return array("<halp_retrieve>worked</halp_retrieve>");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement