Advertisement
Guest User

Untitled

a guest
Apr 18th, 2015
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. <?php
  2. // Override glossify_links theme function in your template.php file
  3. function themename_glossify_links($vars) {
  4. global $base_url;
  5. drupal_add_css(drupal_get_path('module', 'glossify') . '/glossify.css');
  6.  
  7. if ($vars['type'] == 'taxonomy') {
  8. $path = 'taxonomy/term/' . $vars['id'];
  9. }
  10. else {
  11. $path = 'node/' . $vars['id'];
  12. }
  13.  
  14. return l(check_plain($vars['text']), $path, array('html' => true, 'attributes' => array('class' => array('glossify-link'), 'data-glossaryid' => $vars['id'])));
  15. }
  16. ?>
  17.  
  18. // Write some javascript to make the tool tips happen - this is based on bootstrap but could be easily adapted:
  19. (function ($) {
  20. $(document).ready(function () {
  21. $('.glossify-link').tooltip({
  22. html: true,
  23. title: gettooltip,
  24. placement: "bottom"
  25. });
  26. var cachedTooltipData = Array();
  27.  
  28. function gettooltip() {
  29. var element = $(this);
  30. var id = element.data('glossaryid');
  31.  
  32.  
  33. if (id in cachedTooltipData) {
  34. return cachedTooltipData[id];
  35. }
  36.  
  37.  
  38. var localData = "not found";
  39.  
  40. $.ajax(Drupal.settings.basePath + 'rest/node/' + id, {
  41. async: false,
  42. dataType: "json",
  43. success: function (data) {
  44. localData = data.body.und[0].safe_value;
  45. }
  46. });
  47.  
  48. cachedTooltipData[id] = localData;
  49.  
  50. return localData;
  51. }
  52. });
  53. })(jQuery);
  54.  
  55. // Use the services module to setup a new end point (you can import this definition)
  56. <?php
  57. $endpoint = new stdClass();
  58. $endpoint->disabled = FALSE; /* Edit this to true to make a default endpoint disabled initially */
  59. $endpoint->api_version = 3;
  60. $endpoint->name = 'rest';
  61. $endpoint->server = 'rest_server';
  62. $endpoint->path = 'rest';
  63. $endpoint->authentication = array(
  64. 'services' => 'services',
  65. );
  66. $endpoint->server_settings = array();
  67. $endpoint->resources = array(
  68. 'node' => array(
  69. 'operations' => array(
  70. 'retrieve' => array(
  71. 'enabled' => '1',
  72. ),
  73. ),
  74. ),
  75. );
  76. $endpoint->debug = 0;
  77. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement