floating_social_icons.module in Floating Social Icons 8
Contains floating_social_icons.module.
File
floating_social_icons.moduleView source
<?php
/**
* @file
* Contains floating_social_icons.module.
*/
use Drupal\Core\Routing\RouteMatchInterface;
/**
* Implements hook_help().
*/
function floating_social_icons_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
case 'help.page.floating_social_icons':
$output = '';
$output .= '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t('This module allows sites to display sticky social icons and links to other social sites.') . '</p>';
$output .= '<h3>' . t('Configuration') . '</h3>';
$output .= '<p>' . t('Navigate to Administration > Extend and enable the Floating Social Icons module and its dependencies.') . '</p>';
$output .= '<p>' . t('Navigate to Administration > Structure > Block Layout.') . '</p>';
$output .= '<p>' . t('Select the region to place the block. A default block was created when the module was enabled with the name Floating Social Block. Select "Place Block".') . '</p>';
$output .= '<p>' . t('Configure the block and enter the details in their respective fields.') . '</p>';
$output .= '<p>' . t('A minimum of two fields must be filled in.') . '</p>';
$output .= '<p>' . t("In the Display Icons field select where to display the block: left,top, bottom, or right.") . '</p>';
$output .= '<p>' . t('Uncheck the Display title field and place the block in the desired region.') . '</p>';
$output .= '<p>' . t('Select the appropriate visibility settings.') . '</p>';
$output .= '<p>' . t('Select "Save block".') . '</p>';
return $output;
}
}
/**
* Implements hook_theme().
*/
function floating_social_icons_theme($existing, $type, $theme, $path) {
return [
'floating_social_icons_display' => [
'variables' => [
'social_values' => NULL,
'social_titles' => NULL,
],
'template' => 'block--floating-social-icons',
],
];
}
/**
* Implements hook_page_attachments().
*/
function floating_social_icons_page_attachments(array &$attachments) {
// Check for admin
$current_user = \Drupal::currentUser();
$roles = $current_user
->getRoles();
if (in_array("administrator", $roles)) {
$attachments['#attached']['library'][] = 'floating_social_icons/floating_admin_icons';
}
}
Functions
Name | Description |
---|---|
floating_social_icons_help | Implements hook_help(). |
floating_social_icons_page_attachments | Implements hook_page_attachments(). |
floating_social_icons_theme | Implements hook_theme(). |