On this page
Theming and hooks
Last updated on
18 March 2025
Twig template
This module provides a social-media-platforms-links.html.twig with the following variables.
* Available variables:
* - attributes: HTML attributes for the item.
* - display_options: An array of the display options
* - icon_source: The icon source ( none, image or font ).
* - show_label: Whether to show the label or not.
* - target_blank: Whether to add target_blank to the links.
* - platforms: A nested list of link items. Each link item contains:
* - attributes: HTML attributes for the menu item.
* - image: The social media link image path.
* - font_classes: The icon font classes.
* - label: The link title.
* - url: The link URL, instance of \Drupal\Core\UrlReplace default image icons
The module implements a theme element 'social_media_platforms_links', which allows to alter the social media platform icons using a preprocess hook.
function THEME_preprocess_social_media_platforms_links(&$variables) {
$variables['platforms']['facebook']['image'] = 'new image url';
$variables['platforms']['youtube']['image'] = 'new image url';
}CSS Library
The module comes with a minimal css library for styling the block 'social_media_platforms/social_media_platforms.theme'.
This library can be overriden or removed completely to use your custom css styles. For more information on how to do this, you can check here.
Here is an example of how it might look:
libraries-override:
social_media_platforms/social_media_platforms.theme:
css:
theme:
css/social_media_platforms.theme.css: my_css/replacement.cssHelp improve this page
Page status: No known problems
You can:
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion
Still on Drupal 7? Security support for Drupal 7 ended on 5 January 2025. Please visit our Drupal 7 End of Life resources page to review all of your options.
Social Media Platforms