You are here

rrssb.api.php in Ridiculously Responsive Social Sharing Buttons 8.2

Same filename and directory in other branches
  1. 7.2 rrssb.api.php
  2. 7 rrssb.api.php

Hooks provided by the Ridiculously Responsive Social Share Buttons module.

File

rrssb.api.php
View source
<?php

/**
 * @file
 * Hooks provided by the Ridiculously Responsive Social Share Buttons module.
 */

/**
 * Provide configuration for social share buttons.
 *
 * @return array
 *   Array of button configuration.  The key is an identifier for the button.
 *   The value is an associative array that may contain the following key-value pairs.
 *   You must pass at least one of share_url and follow_url, and you may pass both.
 *   - "svg": Required.  SVG definition, in the form of an <svg> tag and contained paths.
 *     The SVG should be minified, without any width/height/fill/etc.
 *   - "share_url": URL for users to share your page using this social media site.  Placeholders {{param}}
 *     will be replaced with values from the current page: url; title; image.
 *   - "follow_url": URL for users to follow you using this social media site.  Placeholder {{username}}
 *     will be replaced with the user name you configured for this social media site.
 *   - "color": Background color to use for this button.
 *   - "color_hover": Background color to use for this button on hover.
 *   - "text": Text to use for this button.  Defaults to the identifier used as a key for this button.
 *   - "popup": Whether to use the popup class for this button.  Defaults to TRUE.
 *
 * @see rrssb_rrssb_buttons()
 */
function hook_rrssb_buttons() {
}

/**
 * Alter the configuration for social share buttons provided by other modules.
 *
 * @param array $buttons
 *   Existing button configuration, see @hook_rrssb_buttons.
 */
function hook_rrssb_buttons_alter(&$buttons) {

  // Set the email button follow action to link to the simplenews subscribe page.
  if (\Drupal::service('module_handler')
    ->moduleExists('simplenews')) {
    $buttons['email']['follow_url'] = '/newsletter/subscriptions';
    $buttons['email']['title_follow'] = 'subscribe';
  }
}

Functions

Namesort descending Description
hook_rrssb_buttons Provide configuration for social share buttons.
hook_rrssb_buttons_alter Alter the configuration for social share buttons provided by other modules.