Fix Drupal 8 Coding Standards #2

This commit is contained in:
samiahmedsiddiqui 2017-09-18 11:57:51 +05:00
parent 98161a6384
commit 7ddda31027
3 changed files with 22 additions and 16 deletions

View File

@ -2,8 +2,8 @@
/**
* @file
* Enables Drupal to add scripts and styles from frontend
* on all over the site.
* Add scripts and styles from the frontend on all over the site.
* Attach the Scripts and Styles as per your need.
*/
/**
@ -54,7 +54,8 @@ function header_and_footer_scripts_page_top(array &$page_top) {
$attr_key_value = explode('=', $attr);
if (isset($attr_key_value[0]) && isset($attr_key_value[1])) {
$style_attr[$attr_key_value[0]] = $attr_key_value[1];
} else {
}
else {
$style_attr[$attr_key_value[0]] = $attr_key_value[0];
}
}
@ -111,7 +112,8 @@ function header_and_footer_scripts_page_top(array &$page_top) {
$attr_key_value = explode('=', $attr);
if (isset($attr_key_value[0]) && isset($attr_key_value[1])) {
$script_attr[$attr_key_value[0]] = $attr_key_value[1];
} else {
}
else {
$script_attr[$attr_key_value[0]] = $attr_key_value[0];
}
}
@ -123,7 +125,7 @@ function header_and_footer_scripts_page_top(array &$page_top) {
'#value' => $value,
];
if (is_array($script_attr)) {
$page_top['top_scripts_'.$i]['#attributes'] = $script_attr;
$page_top['top_scripts_' . $i]['#attributes'] = $script_attr;
}
$i++;
}
@ -178,7 +180,8 @@ function header_and_footer_scripts_page_bottom(array &$page_bottom) {
$attr_key_value = explode('=', $attr);
if (isset($attr_key_value[0]) && isset($attr_key_value[1])) {
$style_attr[$attr_key_value[0]] = $attr_key_value[1];
} else {
}
else {
$style_attr[$attr_key_value[0]] = $attr_key_value[0];
}
}
@ -200,7 +203,9 @@ function header_and_footer_scripts_page_bottom(array &$page_bottom) {
$i = 1;
foreach ($output_scripts as $row) {
if (empty($row)) continue;
if (empty($row)) {
continue;
}
$script_tag = 'script';
$script_attr = '';
@ -233,7 +238,8 @@ function header_and_footer_scripts_page_bottom(array &$page_bottom) {
$attr_key_value = explode('=', $attr);
if (isset($attr_key_value[0]) && isset($attr_key_value[1])) {
$script_attr[$attr_key_value[0]] = $attr_key_value[1];
} else {
}
else {
$script_attr[$attr_key_value[0]] = $attr_key_value[0];
}
}

View File

@ -7,7 +7,7 @@ use Symfony\Component\HttpFoundation\Request;
use Drupal\Core\Form\FormStateInterface;
/**
* This Class Provides the settings page for adding CSS/JS after the body tag on the site.
* Provide settings page for adding CSS/JS after the start of body tag.
*/
class BodyForm extends ConfigFormBase {
@ -33,8 +33,8 @@ class BodyForm extends ConfigFormBase {
$form['hfs_body'] = [
'#type' => 'fieldset',
'#title' => t('Add Scripts and Styles in body'),
'#description' => t('All the defined scripts and styles in this section would be added next to <strong>body</strong> tag.'),
'#title' => $this->t('Add Scripts and Styles in body'),
'#description' => $this->t('All the defined scripts and styles in this section would be added next to <strong>body</strong> tag.'),
];
$form['hfs_body']['styles'] = [

View File

@ -7,7 +7,7 @@ use Symfony\Component\HttpFoundation\Request;
use Drupal\Core\Form\FormStateInterface;
/**
* This Class Provides the settings page for adding CSS/JS before the end of body tag on the site.
* Provide settings page for adding CSS/JS before the end of body tag.
*/
class FooterForm extends ConfigFormBase {