Hi. Thanks for this module.

I am trying to extend it using a small additional module, to add a whatsapp link.

It should be straightforward, but I seem to be missing something, as site link keeps getting pre-attached to link. i.e

my_site_link/whatsapp://send?text=<raw-encoded-url>&

instead of:

whatsapp://send?text=<raw-encoded-url>&

I am using this in module:

function extra_services_service_links() {
  $links = array();

  $links['whatsapp'] = array(
    'name' => 'Whatsapp',
    'description' => t('Share via Whatsapp'),
    'link' => 'whatsapp://send?text=<raw-encoded-url>&',
  );

  return $links;
}

Please has anyone got any ideas? Also tried "

Comments

zeezhao’s picture

Can't edit original. Trying to say also tried:

'link' => '<a href="whatsapp://send" data-href="raw-encoded-url">share</a>',	
Koen.Pasman’s picture

I'm running into similar problems. I have tried using the hook_service_links() and hook_service_links_alter() but both get pre-attached or cached or whatever you want to call it.

jlenni’s picture

jlarrubia’s picture

#3 Good catch! It worked for me.

Dries Arnolds’s picture

The website from #3 is no longer online. I'm curious what the solution was.

Dries Arnolds’s picture

This is a solution that I found: https://www.drupal.org/project/filter_protocols

jlarrubia’s picture

Hi @pixelstyle,

you can do this programatically by extending the variable 'filter_allowed_protocols' with the protocol you need (e.g. whatsapp):

/**
* Adds whatsapp:// protocol to the list of allowed protocols.
*/
function example_update_7001($sandbox) {
// From include/common.inc @ 1336
$protocols = variable_get('filter_allowed_protocols', array('ftp', 'http', 'https', 'irc', 'mailto', 'news', 'nntp', 'rtsp', 'sftp', 'ssh', 'tel', 'telnet', 'webcal'));
$protocols[] = 'whatsapp';
variable_set('filter_allowed_protocols', $protocols);
}

Source: http://drupalsun.com/mikekeran/2013/11/26/adding-custom-mobile-protocols...