layoutcomponents-8.x-1.14-beta2/modules/lc_simple_social_links/lc_simple_social_links.module
modules/lc_simple_social_links/lc_simple_social_links.module
<?php
/**
* @file
* LC Simple Social Links module file.
*/
use Drupal\Core\Routing\RouteMatchInterface;
/**
* Implements hook_page_attachments().
*/
function lc_simple_social_links_page_attachments(&$page) {
$page['#attached']['library'][] = 'lc_simple_social_links/lc_simple_social_links';
}
/**
* Implements hook_help().
*/
function lc_simple_social_links_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
// Create help page.
case 'help.page.lc_simple_social_links':
$module_handler = \Drupal::service('module_handler');
$module_path = $module_handler->getModule('lc_simple_social_links')->getPath();
$file = $module_path . '/README.md';
if (!file_exists($file)) {
return '';
}
// Get content from file.
$reader = file_get_contents($file);
// Return "clean" content.
return preg_replace("/\r\n|\n|\r/", "<br>", $reader);
}
}
