Hello, I'm running CVS for both Drupal and service_links, I'm enabled the module but as you can see here:

http://www.teleworkpeople.com/a-better-life-doing-nothing

The link is not showing text or correct url. I've enabled "Show del.icio.us link" and service links are active for story nodes (this example is a story).

My other settings are:

Service links in links: disabled
Service links in nodes: full page view
Link style: text links

You can see from my source that I have this: href="/%3C?<#<" , where the url should be, and just a less than sign where the link text should be.

I've got a mytheme_links function in template.php but I disabled it and still had the problem.

I also have something like this in node.tpl.php (I use it to get better control over CSS in links):

<?php if (is_array($node->links)) { ?>

<p class="links">
<?php
global $user;
foreach ($node->links as $key => $link) {
    if ($user->uid) {
      print l($link['#title'],$link['#href'],$link['#attributes'], $link['#query'], $link['#fragment']) . ' ';
    } else {
      print ($page == 1 || (substr_count($link['#title'],'href') > 0)) ? $link['#title'] . ' ': l($link['#title'],$link['#h
ref'],$link['#attributes'], $link['#query'], $link['#fragment']) . ' ';
    }
}
?>
</p>
<?php } ?>

But I replaced this with the standard code from bluemarine and I had the same problem.

Any ideas?

Thanks!

Comments

alexis’s picture

I think I've figured out this:

service_links is not using the forms API, in function _service_links_render() I changed:

if (variable_get('service_links_show_delicious', 0)) {
   $links[] = theme('service_links_build_link', t('delicious'), "http://del.icio.us/post?url=$url&title=$title", t('Bookmark this post on del.icio.us.'), 'delicious.png');
  }

to:

if (variable_get('service_links_show_delicious', 0)) {
    $links[] = array(
       "#title" => t('delicious'),
       "#href" => "http://del.icio.us/post?url=$url&title=$title"
    );
  }

And now it's working. Of course you have to do this for each one of the services.

I haven't tried inserting the image of the services because I'm just relying on text links but you could easily make the change.

Sorry for not posting a patch but I think the module developer could do it better.

Regards!

alexis’s picture

I've inserted the image using some CSS. I added this rule:

a.service_delicious {
  font-size: 1.2em;
  background-image: url(i/delicious.png);
  background-repeat: no-repeat;
  background-position: 0 50%;
  padding-left: 2em;
}

Moved all the images from service_links to the directory "i" under my theme directory. You can leave them where they are but remember CSS background-image url is relative to the path of the CSS file.

Then I just added a class for the link in the function mentioned in my last post:

if (variable_get('service_links_show_delicious', 0)) {
    $links[] = array(
       "#title" => t('delicious'),
       "#href" => "http://del.icio.us/post?url=$url&title=$title",
       "#attributes" => array("rel"=>"nofollow","class"=>"service_delicious")
    );
  }

Do the same for the other services.

I'm bypassing the setting of the module but it should be easy using images or not, it's just a matter of setting the CSS class in the link.

I think this way designers can make changes without touching PHP, just with CSS.

Regards!

frjo’s picture

Category: support » task
Status: Active » Postponed

Thanks for the code.

The cvs version of Service links is for 4.7 and I have no plans to start coding for 4.8 before they start to release beta versions.

In the handbook page "Converting 4.7 modules to 4.8" http://drupal.org/node/64279 the change to hook_link is explained.

alexis’s picture

Hi, I just wanted to add that I made a mistake when mentioning the forms API, that's included already in service_links. What I meant was the new way how $links array is used, which, you are correct, it's a feature of CVS, and 4.8 of course.

Regards!

apsivam’s picture

Status: Postponed » Closed (fixed)