Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
bootstrap_barrio-3382683
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
Issue forks
bootstrap_barrio-3382683
Commits
56e215d0
Commit
56e215d0
authored
6 years ago
by
Alberto Siles
Browse files
Options
Downloads
Patches
Plain Diff
Make region setup administrable
parent
f3823fb8
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
bootstrap_barrio.theme
+17
-1
17 additions, 1 deletion
bootstrap_barrio.theme
templates/layout/region.html.twig
+0
-1
0 additions, 1 deletion
templates/layout/region.html.twig
theme-settings.php
+54
-0
54 additions, 0 deletions
theme-settings.php
with
71 additions
and
2 deletions
bootstrap_barrio.theme
+
17
−
1
View file @
56e215d0
...
...
@@ -300,6 +300,16 @@ function bootstrap_barrio_preprocess_node(&$variables) {
}
}
/**
* Implements hook_preprocess_HOOK() for region.html.twig.
*/
function
bootstrap_barrio_preprocess_region
(
&
$variables
)
{
// Add a clearfix class to system branding blocks.
if
(
theme_get_setting
(
'bootstrap_barrio_region_class_'
.
$variables
[
'elements'
][
'#region'
])
!==
NULL
)
{
$variables
[
'region_classes'
]
=
theme_get_setting
(
'bootstrap_barrio_region_class_'
.
$variables
[
'elements'
][
'#region'
]);
}
}
/**
* Implements hook_preprocess_HOOK() for block.html.twig.
*/
...
...
@@ -372,7 +382,13 @@ function bootstrap_barrio_theme_suggestions_region_alter(array &$suggestions, ar
'sidebar_first'
,
'sidebar_second'
,
];
if
(
in_array
(
$variables
[
'elements'
][
'#region'
],
$nowrap
)
)
{
if
(
theme_get_setting
(
'bootstrap_barrio_region_class_'
.
$variables
[
'elements'
][
'#region'
])
!==
NULL
)
{
$region_clean
=
theme_get_setting
(
'bootstrap_barrio_region_class_'
.
$variables
[
'elements'
][
'#region'
]);
}
else
{
$region_clean
=
in_array
(
$variables
[
'elements'
][
'#region'
],
$nowrap
);
}
if
(
$region_clean
)
{
$suggestions
[]
=
'region__nowrap'
;
}
}
...
...
This diff is collapsed.
Click to expand it.
templates/layout/region.html.twig
+
0
−
1
View file @
56e215d0
...
...
@@ -15,7 +15,6 @@
{%
set
classes
=
[
'region'
,
'row'
,
'region-'
~
region
|
clean_class
,
]
%}
...
...
This diff is collapsed.
Click to expand it.
theme-settings.php
+
54
−
0
View file @
56e215d0
...
...
@@ -76,6 +76,60 @@ function bootstrap_barrio_form_system_theme_settings_alter(&$form, FormStateInte
)),
);
// List of regions
$theme
=
\Drupal
::
theme
()
->
getActiveTheme
()
->
getName
();
$region_list
=
system_region_list
(
$theme
,
$show
=
REGIONS_ALL
);
// Only for initial setup if not defined on install
$nowrap
=
[
'breadcrumb'
,
'content'
,
'primary_menu'
,
'header'
,
'sidebar_first'
,
'sidebar_second'
,
];
//Region
$form
[
'layout'
][
'region'
]
=
array
(
'#type'
=>
'details'
,
'#title'
=>
t
(
'Region'
),
'#collapsible'
=>
TRUE
,
'#collapsed'
=>
TRUE
,
);
foreach
(
$region_list
as
$name
=>
$description
)
{
if
(
theme_get_setting
(
'bootstrap_barrio_region_clean_'
.
$name
)
!==
NULL
)
{
$region_clean
=
theme_get_setting
(
'bootstrap_barrio_region_clean_'
.
$name
);
}
else
{
$region_clean
=
in_array
(
$name
,
$nowrap
);
}
if
(
theme_get_setting
(
'bootstrap_barrio_region_class_'
.
$name
)
!==
NULL
)
{
$region_class
=
theme_get_setting
(
'bootstrap_barrio_region_class_'
.
$name
);
}
else
{
$region_class
=
$region_clean
?
NULL
:
'row'
;
}
$form
[
'layout'
][
'region'
][
$name
]
=
array
(
'#type'
=>
'details'
,
'#title'
=>
$description
,
'#collapsible'
=>
TRUE
,
'#collapsed'
=>
TRUE
,
);
$form
[
'layout'
][
'region'
][
$name
][
'bootstrap_barrio_region_clean_'
.
$name
]
=
array
(
'#type'
=>
'checkbox'
,
'#title'
=>
t
(
'Clean wrapper for @description region'
,
array
(
'@description'
=>
$description
)),
'#default_value'
=>
$region_clean
,
);
$form
[
'layout'
][
'region'
][
$name
][
'bootstrap_barrio_region_class_'
.
$name
]
=
array
(
'#type'
=>
'textfield'
,
'#title'
=>
t
(
'Classes for @description region'
,
array
(
'@description'
=>
$description
)),
'#default_value'
=>
theme_get_setting
(
'bootstrap_barrio_region_class_'
.
$name
),
'#size'
=>
40
,
'#maxlength'
=>
40
,
);
}
// Sidebar Position
$form
[
'layout'
][
'sidebar_position'
]
=
array
(
'#type'
=>
'details'
,
...
...
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