Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Override glossify_links theme function in your template.php file
- function themename_glossify_links($vars) {
- global $base_url;
- drupal_add_css(drupal_get_path('module', 'glossify') . '/glossify.css');
- if ($vars['type'] == 'taxonomy') {
- $path = 'taxonomy/term/' . $vars['id'];
- }
- else {
- $path = 'node/' . $vars['id'];
- }
- return l(check_plain($vars['text']), $path, array('html' => true, 'attributes' => array('class' => array('glossify-link'), 'data-glossaryid' => $vars['id'])));
- }
- ?>
- // Write some javascript to make the tool tips happen - this is based on bootstrap but could be easily adapted:
- (function ($) {
- $(document).ready(function () {
- $('.glossify-link').tooltip({
- html: true,
- title: gettooltip,
- placement: "bottom"
- });
- var cachedTooltipData = Array();
- function gettooltip() {
- var element = $(this);
- var id = element.data('glossaryid');
- if (id in cachedTooltipData) {
- return cachedTooltipData[id];
- }
- var localData = "not found";
- $.ajax(Drupal.settings.basePath + 'rest/node/' + id, {
- async: false,
- dataType: "json",
- success: function (data) {
- localData = data.body.und[0].safe_value;
- }
- });
- cachedTooltipData[id] = localData;
- return localData;
- }
- });
- })(jQuery);
- // Use the services module to setup a new end point (you can import this definition)
- <?php
- $endpoint = new stdClass();
- $endpoint->disabled = FALSE; /* Edit this to true to make a default endpoint disabled initially */
- $endpoint->api_version = 3;
- $endpoint->name = 'rest';
- $endpoint->server = 'rest_server';
- $endpoint->path = 'rest';
- $endpoint->authentication = array(
- 'services' => 'services',
- );
- $endpoint->server_settings = array();
- $endpoint->resources = array(
- 'node' => array(
- 'operations' => array(
- 'retrieve' => array(
- 'enabled' => '1',
- ),
- ),
- ),
- );
- $endpoint->debug = 0;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement