Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
coder
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
coder
Commits
05f20ead
Commit
05f20ead
authored
8 years ago
by
Mark Shropshire
Committed by
Klaus Purer
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
fix(HookInitCssSniff): Improve warning message wording (
#2817537
by shrop)
parent
403dccd2
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
coder_sniffer/DrupalPractice/Sniffs/FunctionDefinitions/HookInitCssSniff.php
+2
-2
2 additions, 2 deletions
...lPractice/Sniffs/FunctionDefinitions/HookInitCssSniff.php
with
2 additions
and
2 deletions
coder_sniffer/DrupalPractice/Sniffs/FunctionDefinitions/HookInitCssSniff.php
+
2
−
2
View file @
05f20ead
...
@@ -68,10 +68,10 @@ class DrupalPractice_Sniffs_FunctionDefinitions_HookInitCssSniff extends Drupal_
...
@@ -68,10 +68,10 @@ class DrupalPractice_Sniffs_FunctionDefinitions_HookInitCssSniff extends Drupal_
&&
$tokens
[
$opener
][
'code'
]
===
T_OPEN_PARENTHESIS
&&
$tokens
[
$opener
][
'code'
]
===
T_OPEN_PARENTHESIS
)
{
)
{
if
(
$tokens
[
$stackPtr
][
'content'
]
===
(
$fileName
.
'_init'
))
{
if
(
$tokens
[
$stackPtr
][
'content'
]
===
(
$fileName
.
'_init'
))
{
$warning
=
'Do not use %s() in hook_init(),
move it to
your page/form callback or
use
hook_page_build() instead'
;
$warning
=
'Do not use %s() in hook_init(),
use #attached for CSS and JS in
your page/form callback or
in
hook_page_build() instead'
;
$phpcsFile
->
addWarning
(
$warning
,
$string
,
'AddFunctionFound'
,
array
(
$tokens
[
$string
][
'content'
]));
$phpcsFile
->
addWarning
(
$warning
,
$string
,
'AddFunctionFound'
,
array
(
$tokens
[
$string
][
'content'
]));
}
else
{
}
else
{
$warning
=
'Do not use %s() in hook_page_build(), use #attached on the $page render array instead'
;
$warning
=
'Do not use %s() in hook_page_build(), use #attached
for CSS and JS
on the $page render array instead'
;
$phpcsFile
->
addWarning
(
$warning
,
$string
,
'AddFunctionFoundPageBuild'
,
array
(
$tokens
[
$string
][
'content'
]));
$phpcsFile
->
addWarning
(
$warning
,
$string
,
'AddFunctionFoundPageBuild'
,
array
(
$tokens
[
$string
][
'content'
]));
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment