Guest User

Untitled

a guest
Apr 19th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. privacy":{"value":"1"},
  2.  
  3. "privacy":[]
  4.  
  5. For Private : privacy":{"value":"1"},
  6. For Public : privacy":{"value":"0"},
  7.  
  8. function my_module_services_request_postprocess_alter($controller, $args, &$result) {
  9. // In my response, I include the request string in the '_links' array.
  10. // I can use this now to determine which resource was requested.
  11. if (strpos($result->_links['self']['href'], 'api/1.0/widget')) {
  12. // Now I know I'm dealing with a widget request, so I'll
  13. // add the random string here...
  14. $result->String = "This is a string that I'm adding to the widget response";
  15. }
  16. }
  17.  
  18. Array (
  19. [_links] => Array (
  20. [self] => Array (
  21. [href] => /api/1.0/widget/12345
  22. )
  23. )
  24.  
  25. [count] => 1
  26. [_embedded] => Array (
  27. [0] => Array (
  28. [id] => 12345
  29. [type] => widget
  30. [path] => /node/157601
  31. )
  32. )
  33. [String] => 'This is a string that I'm adding to the widget response'
  34. )
Add Comment
Please, Sign In to add comment