Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
blocktheme
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
blocktheme
Commits
e30683cb
Commit
e30683cb
authored
11 months ago
by
Viktor Holovachek
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3432696
- Fix spell
parent
144fff00
No related branches found
No related tags found
1 merge request
!7
Issue #3432696 - Fix spell
Pipeline
#125166
passed
11 months ago
Stage: build
Stage: validate
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.cspell.json
+19
-0
19 additions, 0 deletions
.cspell.json
README.md
+5
-5
5 additions, 5 deletions
README.md
blocktheme.module
+9
-9
9 additions, 9 deletions
blocktheme.module
with
33 additions
and
14 deletions
.cspell.json
0 → 100644
+
19
−
0
View file @
e30683cb
{
"version"
:
"0.2"
,
"language"
:
"en"
,
"words"
:
[
"Holovachek"
,
"Viktor"
,
"Mateescu"
,
"amateescu"
,
"Shudra"
],
"ignoreWords"
:
[
"Blocktheme"
,
"blocktheme"
,
"blockthemes"
,
"isset"
,
"colspan"
,
"preprocess"
]
}
This diff is collapsed.
Click to expand it.
README.md
+
5
−
5
View file @
e30683cb
...
...
@@ -36,17 +36,17 @@ information, see
1.
Enable the module
2.
Go to /admin/structure/block/blocktheme and add entries like:
customtemplate|My Custom Template
mysupertemplate|My SuperTemplate
custom
_
template|My Custom Template
my
_
super
_
template|My SuperTemplate
Where the first name is the machine-readable name of your template which may contain only
alphanumerical characters, -, or _ . The second name is the user-friendly name that appears
in the selecti
o
nbox on the block edit form.
in the select
inbox on the block edit form.
3.
Choose from either step 4. or 5.
4.
Create twig files in your theme directory like: (Note: filenames must be preceded by block--blocktheme--)
block--blocktheme--customtemplate.html.twig
block--blocktheme--mysupertemplate.html.twig
block--blocktheme--custom
-
template.html.twig
block--blocktheme--my
-
super
-
template.html.twig
5.
Alternatively use the extra provided variable $blocktheme to customize your
block.html.twig or block-
*
.html.twig files. The $blocktheme will typically be
...
...
This diff is collapsed.
Click to expand it.
blocktheme.module
+
9
−
9
View file @
e30683cb
...
...
@@ -131,15 +131,15 @@ function blocktheme_form_block_admin_display_form_alter(&$form, FormStateInterfa
$config
=
\Drupal
::
config
(
'blocktheme.settings'
)
->
get
(
'show'
);
if
(
!
empty
(
$config
))
{
$form
[
'blocks'
][
'#header'
][]
=
t
(
'Custom theme'
);
foreach
(
$form
[
'blocks'
]
as
$block
=>
$parametrs
)
{
foreach
(
$form
[
'blocks'
]
as
$block
=>
$paramet
e
rs
)
{
if
(
isset
(
$parametrs
[
'message'
]))
{
if
(
isset
(
$paramet
e
rs
[
'message'
]))
{
$form
[
'blocks'
][
$block
][
'message'
][
'#wrapper_attributes'
][
'colspan'
]
++
;
}
if
(
isset
(
$parametrs
[
'title'
]))
{
if
(
isset
(
$paramet
e
rs
[
'title'
]))
{
$form
[
'blocks'
][
$block
][
'title'
][
'#wrapper_attributes'
][
'colspan'
]
++
;
}
if
(
isset
(
$parametrs
[
'weight'
]))
{
if
(
isset
(
$paramet
e
rs
[
'weight'
]))
{
$template
=
blocktheme_get_theme_name
(
$block
);
$form
[
'blocks'
][
$block
][]
=
[
'#markup'
=>
!
empty
(
$template
)
?
$template
:
''
,
...
...
@@ -245,11 +245,11 @@ function blocktheme_save($form, FormStateInterface $form_state) {
function
blocktheme_get_blockthemes
()
{
$options
=
[];
$config
=
\Drupal
::
config
(
'blocktheme.settings'
);
$blockthemes
=
$config
->
get
(
'templates'
);
$block
_
themes
=
$config
->
get
(
'templates'
);
$options
[]
=
t
(
'- None -'
);
if
(
$blockthemes
)
{
foreach
(
$blockthemes
as
$values
)
{
if
(
$block
_
themes
)
{
foreach
(
$block
_
themes
as
$values
)
{
$options
[
$values
[
'name'
]]
=
$values
[
'label'
];
}
}
...
...
@@ -293,8 +293,8 @@ function blocktheme_format_vars_admin($block_vars) {
* Get custom theme for a block.
*/
function
blocktheme_get_theme
(
$block
)
{
$blocktheme
=
blocktheme_get
();
return
!
empty
(
$blocktheme
[
$block
])
?
$blocktheme
[
$block
]
:
NULL
;
$block
_
theme
=
blocktheme_get
();
return
!
empty
(
$block
_
theme
[
$block
])
?
$block
_
theme
[
$block
]
:
NULL
;
}
/**
...
...
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