Updated README.txt, implemented hook_help, and fixed coding standard issues
This commit is contained in:
parent
eac6f1730f
commit
912591d36e
58
README.txt
58
README.txt
@ -1,20 +1,48 @@
|
||||
INTRODUCTION
|
||||
------------
|
||||
|
||||
HFS (Header Footer Scripts) module for Drupal 8.x.
|
||||
This module allows you to add style and scripts in different region of the page
|
||||
from the front-end. You don't need to open any file for this purpose.
|
||||
|
||||
INSTALLATION INSTRUCTIONS
|
||||
-------------------------
|
||||
1. Copy the files included in the tarball into a directory named
|
||||
"header_and_footer_scripts" in your Drupal modules/ directory.
|
||||
2. Login as site administrator.
|
||||
3. Enable the HFS (Header Footer Scripts) module on the
|
||||
Administer -> Modules page.
|
||||
4. Add styles and scripts in settings on the Administer ->
|
||||
Configuration -> Development -> HFS (Header Footer Scripts) Page.
|
||||
5. Enjoy.
|
||||
|
||||
NOTES
|
||||
-----
|
||||
This module adds the styles and scripts on all over the site. There are 3
|
||||
setting pages.
|
||||
These setting pages are allow you add the scripts in the desired region.
|
||||
setting pages. These setting pages are allow you add the scripts
|
||||
in the desired region.
|
||||
|
||||
REQUIREMENTS
|
||||
------------
|
||||
|
||||
No special requirements.
|
||||
|
||||
INSTALLATION
|
||||
------------
|
||||
|
||||
* Install as you would normally install a contributed Drupal module. Visit:
|
||||
https://www.drupal.org/docs/8/extending-drupal-8/installing-drupal-8-modules
|
||||
for further information.
|
||||
|
||||
CONFIGURATION
|
||||
-------------
|
||||
|
||||
* Configure user permissions in Administration » People » Permissions
|
||||
|
||||
- Access HFS (Header Footer Scripts)
|
||||
|
||||
Users in roles with "Add Scripts all over the site" permission will
|
||||
add / remove the styles and scripts from any position.
|
||||
|
||||
* Add styles and scripts in settings on the Administer ->
|
||||
Configuration -> Development -> HFS (Header Footer Scripts) Page.
|
||||
|
||||
MAINTAINERS
|
||||
-----------
|
||||
|
||||
Current maintainers:
|
||||
* Aliya Yasir (aliyayasir) - https://www.drupal.org/user/213804
|
||||
* Sami Ahmed Siddiqui (sasiddiqui) - https://www.drupal.org/user/3100375
|
||||
|
||||
This project has been sponsored by:
|
||||
* YAS Global
|
||||
Leading Web and App Development company, which helps businesses to grow
|
||||
online using advanced platforms. It works on Drupal, WordPress, .Net and
|
||||
Mobile Apps. Visit https://www.yasglobal.com for more information.
|
||||
|
@ -2,4 +2,4 @@ hfs.admin.body_settings:
|
||||
title: 'HFS (Header Footer Scripts)'
|
||||
description: 'Allow to add scripts and styles from the frontend at the start of body tag.'
|
||||
parent: system.admin_config_development
|
||||
route_name: hfs.admin.body_settings
|
||||
route_name: hfs.admin.header_settings
|
||||
|
@ -1,12 +1,12 @@
|
||||
hfs.admin.header_settings:
|
||||
route_name: hfs.admin.header_settings
|
||||
title: 'Header Scripts'
|
||||
base_route: hfs.admin.body_settings
|
||||
base_route: hfs.admin.header_settings
|
||||
hfs.admin.body_settings:
|
||||
route_name: hfs.admin.body_settings
|
||||
title: 'Body Scripts'
|
||||
base_route: hfs.admin.body_settings
|
||||
base_route: hfs.admin.header_settings
|
||||
hfs.admin.footer_settings:
|
||||
route_name: hfs.admin.footer_settings
|
||||
title: 'Footer Scripts'
|
||||
base_route: hfs.admin.body_settings
|
||||
base_route: hfs.admin.header_settings
|
||||
|
@ -5,6 +5,22 @@
|
||||
* Add scripts and styles from the frontend on all over the site.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_help().
|
||||
*/
|
||||
function header_and_footer_scripts_help($route_name,
|
||||
\Drupal\Core\Routing\RouteMatchInterface $route_match) {
|
||||
switch ($route_name) {
|
||||
case 'help.page.header_and_footer_scripts':
|
||||
$output = '<h2>' . t('About') . '</h2>';
|
||||
$output .= '<p>' . t('This module allows you to add style and scripts in your site or , You don\'t need to open any file for this purpose.') . '</p>';
|
||||
$output .= '<h2>' . t('Uses') . '</h2>';
|
||||
$output .= '<p>' . t('Header and Footer Scripts provides you the capability to quickly add the style and scripts in your site. It provides you 3 regions (Header, Body, and Footer) of the page on which you can add the style and script. You can add custom style/script file, add Google or other Analytics code, inline css, inline js and so on. You can configure them from the Administer -> Configuration -> Development -> HFS (Header Footer Scripts)') . '</p>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_page_top().
|
||||
*
|
||||
@ -312,11 +328,11 @@ function header_and_footer_scripts_page_attachments_alter(array &$attachments) {
|
||||
}
|
||||
}
|
||||
|
||||
$attachments['#attached']['html_head'][$i][0] = array(
|
||||
$attachments['#attached']['html_head'][$i][0] = [
|
||||
'#type' => 'html_tag',
|
||||
'#tag' => $style_tag,
|
||||
'#value' => $value
|
||||
);
|
||||
'#value' => $value,
|
||||
];
|
||||
if (is_array($style_attr)) {
|
||||
$attachments['#attached']['html_head'][$i][0]['#attributes'] = $style_attr;
|
||||
}
|
||||
@ -373,14 +389,14 @@ function header_and_footer_scripts_page_attachments_alter(array &$attachments) {
|
||||
}
|
||||
}
|
||||
|
||||
$attachments['#attached']['html_head'][$i] = array(
|
||||
array(
|
||||
$attachments['#attached']['html_head'][$i] = [
|
||||
[
|
||||
'#type' => 'html_tag',
|
||||
'#tag' => $script_tag,
|
||||
'#value' => $value,
|
||||
),
|
||||
'header-and-footer-scripts-' . $i
|
||||
);
|
||||
],
|
||||
'header-and-footer-scripts-' . $i,
|
||||
];
|
||||
if (is_array($script_attr)) {
|
||||
$attachments['#attached']['html_head'][$i][0]['#attributes'] = $script_attr;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user