Skip to content

Instantly share code, notes, and snippets.

@linuslundahl
Created April 11, 2012 10:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save linuslundahl/2358357 to your computer and use it in GitHub Desktop.
Save linuslundahl/2358357 to your computer and use it in GitHub Desktop.
Services resource definition
$resources['ur_segment'] = array(
'operations' => array(
'create' => array(
'callback' => '_ur_segment_create',
'help' => t('Creates a segment.'),
'args' => array(
array(
'name' => 'segment',
'optional' => FALSE,
'source' => 'data',
'description' => 'The data for the segment to create',
'type' => 'array',
),
),
'access callback' => 'ne_product_user_has_access',
'access arguments' => array('ur'),
'access arguments append' => FALSE,
),
'delete' => array(
'callback' => '_ur_segment_delete',
'help' => t('Deletes a segment.'),
'args' => array(
array(
'name' => 'id',
'optional' => FALSE,
'source' => array('path' => 0),
'description' => 'The id of the segment to delete',
'type' => 'int',
),
array(
'name' => 'media_id',
'optional' => FALSE,
'source' => array('param' => 'media_id'),
'description' => 'The id of the segment to add a link to',
'type' => 'int',
),
),
'access callback' => '_ne_ur_segment_delete_access',
'access arguments append' => TRUE,
),
),
'targeted_actions' => array(
'link' => array(
'callback' => '_ur_segment_add_link',
'help' => t('Adds a link to a segment.'),
'args' => array(
array(
'name' => 'id',
'optional' => FALSE,
'source' => array('path' => 0),
'description' => 'The id of the segment to add a link to',
'type' => 'int',
),
array(
'name' => 'data',
'optional' => FALSE,
'source' => 'data',
'description' => 'The link info',
'type' => 'array',
),
),
'access callback' => '_ne_ur_segment_delete_access',
'access arguments append' => TRUE,
),
),
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment