Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
CSU
tweeki
Commits
dfef93a6
Unverified
Commit
dfef93a6
authored
Jul 28, 2020
by
Tobias Haider
Committed by
GitHub
Jul 28, 2020
Browse files
Merge pull request #161 from Ammarpad/patch-1
Use hook to add body attributes
parents
e3366cb2
4864c263
Changes
3
Hide whitespace changes
Inline
Side-by-side
includes/Hooks.php
View file @
dfef93a6
...
...
@@ -924,5 +924,13 @@ class TweekiHooks {
}
return
true
;
}
public
static
function
onOutputPageBodyAttributes
(
$out
,
$sk
,
&
$bodyAttrs
)
{
if
(
isset
(
$bodyAttrs
[
'class'
]
)
&&
strlen
(
$bodyAttrs
[
'class'
]
)
>
0
)
{
$bodyAttrs
[
'class'
]
.
=
' '
.
implode
(
' '
,
SkinTweeki
::
$bodyClasses
);
}
else
{
$bodyAttrs
[
'class'
]
=
implode
(
' '
,
SkinTweeki
::
$bodyClasses
);
}
}
}
includes/SkinTweeki.php
View file @
dfef93a6
...
...
@@ -42,7 +42,7 @@ class SkinTweeki extends SkinTemplate {
->
makeConfig
(
'tweeki'
);
}
p
rotected
static
$bodyClasses
=
array
(
'tweeki-animateLayout'
);
p
ublic
static
$bodyClasses
=
array
(
'tweeki-animateLayout'
);
/**
...
...
@@ -87,21 +87,7 @@ class SkinTweeki extends SkinTemplate {
Hooks
::
run
(
'SkinTweekiStyleModules'
,
array
(
$this
,
&
$styles
)
);
$out
->
addModuleStyles
(
$styles
);
}
/**
* Adds classes to the body element.
*
* @param $out OutputPage object
* @param &$bodyAttrs Array of attributes that will be set on the body element
*/
function
addToBodyAttributes
(
$out
,
&
$bodyAttrs
)
{
if
(
isset
(
$bodyAttrs
[
'class'
]
)
&&
strlen
(
$bodyAttrs
[
'class'
]
)
>
0
)
{
$bodyAttrs
[
'class'
]
.
=
' '
.
implode
(
' '
,
static
::
$bodyClasses
);
}
else
{
$bodyAttrs
[
'class'
]
=
implode
(
' '
,
static
::
$bodyClasses
);
}
}
/**
* Override to pass our Config instance to it
* @param string $classname
...
...
skin.json
View file @
dfef93a6
...
...
@@ -37,7 +37,8 @@
"MagicWordMagicWords"
:
"TweekiHooks::onMagicWordMagicWords"
,
"MagicWordwgVariableIDs"
:
"TweekiHooks::onMagicWordwgVariableIDs"
,
"InternalParseBeforeLinks"
:
"TweekiHooks::onInternalParseBeforeLinks"
,
"OutputPageBeforeHTML"
:
"TweekiHooks::onOutputPageBeforeHTML"
"OutputPageBeforeHTML"
:
"TweekiHooks::onOutputPageBeforeHTML"
,
"OutputPageBodyAttributes"
:
"TweekiHooks::onOutputPageBodyAttributes"
},
"ResourceModules"
:
{
"skins.tweeki.bootstrap.styles"
:
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment