Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I should add an on_the_web.api.php file that documents use of hook_on_the_web_get_services_alter().
Here's a good example:
/**
* Implements hook_on_the_web_get_services_alter().
* Puts facebook at the very front of the list of icons.
*/
function mymodule_on_the_web_get_services_alter(&$services) {
// Pull out facebook.
$face = $services['facebook'];
// Remove facebook.
unset($services['facebook']);
// Put facebook at the begining.
$services = array('facebook' => $face)+$services;
}
Comments
Comment #1
jenlamptonComment #2
davidneedhamI'm curious to see what else can be done with the API. Is there a way to manually add additional services? Obviously a simple hook wouldn't work...
In the meantime I've put my service url into an option I'm not using and using this great tip to change the name and image replace the link.
Comment #3
jenlampton@davidneedham yes, you should be able to add an additional service the same way you modified the unused one. You may also need to override
theme_on_the_web_image()
to specify the location of the icon you want to use if you aren't putting it into the same directory as all the others, but it should work in the same way.Comment #4
jenlamptonI just added an on_the_web.api.php file for documentation purposes.