Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
uw_cfg_common
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
WCMS
uw_cfg_common
Commits
7854218d
Commit
7854218d
authored
4 years ago
by
Eric Bremner
Browse files
Options
Downloads
Patches
Plain Diff
ISTWCMS-4053: adding five column layout and updating layout names
parent
c3d9092b
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/Plugin/Layout/UwFiveColumnLayout.php
+94
-0
94 additions, 0 deletions
src/Plugin/Layout/UwFiveColumnLayout.php
uw_cfg_common.layouts.yml
+23
-4
23 additions, 4 deletions
uw_cfg_common.layouts.yml
with
117 additions
and
4 deletions
src/Plugin/Layout/UwFiveColumnLayout.php
0 → 100644
+
94
−
0
View file @
7854218d
<?php
namespace
Drupal\uw_cfg_common\Plugin\Layout
;
use
Drupal\Core\Form\FormStateInterface
;
use
Drupal\Core\Layout\LayoutDefault
;
use
Drupal\Core\Plugin\PluginFormInterface
;
/**
* A UW four column layout.
*
* @Layout(
* id = "uw_five_column",
* label = @Translation("Five columns"),
* category = @Translation("UW layouts"),
* template = "templates/layout/layout--uwfivecol",
* regions = {
* "first" = {
* "label" = @Translation("Column 1"),
* },
* "second" = {
* "label" = @Translation("Column 2"),
* },
* "third" = {
* "label" = @Translation("Column 3"),
* },
* "fourth" = {
* "label" = @Translation("Column 4"),
* },
* "fifth" = {
* "label" = @Translation("Column 5"),
* },
* }
* )
*/
class
UwFiveColumnLayout
extends
LayoutDefault
implements
PluginFormInterface
{
/**
* {@inheritdoc}
*/
public
function
buildConfigurationForm
(
array
$form
,
FormStateInterface
$form_state
)
{
// Get the config for this layout.
$configuration
=
$this
->
getConfiguration
();
// The options for the column widths.
$options
=
[
'even-split'
=>
$this
->
t
(
'Even split (20%, 20%, 20%, 20%, 20%)'
),
'larger-left'
=>
$this
->
t
(
'Larger left (40%, 15%, 15%, 15%, 15%)'
),
'larger-second'
=>
$this
->
t
(
'Larger second (15%, 40%, 15%, 15%, 15%)'
),
'larger-third'
=>
$this
->
t
(
'Larger third (15%, 15%, 40%, 15%, 15%)'
),
'larger-fourth'
=>
$this
->
t
(
'Larger fourth (15%, 15%, 15%, 40%, 15%)'
),
'larger-right'
=>
$this
->
t
(
'Larger right (15%, 15%, 15%, 15%, 40%)'
),
'legacy-23-19-19-19-20'
=>
$this
->
t
(
'Legacy (23%, 19%, 19%, 19%, 20%)'
),
];
// The form element for the column widths.
$form
[
'layout_settings'
][
'column_class'
]
=
[
'#type'
=>
'select'
,
'#title'
=>
$this
->
t
(
'Column widths'
),
'#default_value'
=>
!
empty
(
$configuration
[
'column_class'
])
?
$configuration
[
'column_class'
]
:
'even-split'
,
'#options'
=>
$options
,
];
return
$form
;
}
/**
* {@inheritdoc}
*/
public
function
submitConfigurationForm
(
array
&
$form
,
FormStateInterface
$form_state
)
{
// Set the column class in the config.
$this
->
configuration
[
'column_class'
]
=
$form_state
->
getValue
([
'layout_settings'
,
'column_class'
],
NULL
);
}
/**
* {@inheritdoc}
*/
public
function
build
(
array
$regions
)
{
// Build the render array as usual.
$build
=
parent
::
build
(
$regions
);
// Retrieve the config for the layout.
$configuration
=
$this
->
getConfiguration
();
// Set the column class to be used in the layout template.
$build
[
'#settings'
][
'column_class'
]
=
$configuration
[
'column_class'
];
return
$build
;
}
}
This diff is collapsed.
Click to expand it.
uw_cfg_common.layouts.yml
+
23
−
4
View file @
7854218d
uw_one_column
:
uw_one_column
:
label
:
'
UW
One
column'
label
:
'
One
column'
category
:
'
UW
layouts'
category
:
'
UW
layouts'
class
:
'
\Drupal\uw_cfg_common\Plugin\Layout\UwOneColumnLayout'
class
:
'
\Drupal\uw_cfg_common\Plugin\Layout\UwOneColumnLayout'
template
:
uw_fdsu_theme_resp/templates/layout/layout--uwonecol
template
:
uw_fdsu_theme_resp/templates/layout/layout--uwonecol
...
@@ -10,7 +10,7 @@ uw_one_column:
...
@@ -10,7 +10,7 @@ uw_one_column:
icon_map
:
icon_map
:
-
[
first
]
-
[
first
]
uw_two_column
:
uw_two_column
:
label
:
'
UW
Two
columns'
label
:
'
Two
columns'
category
:
'
UW
layouts'
category
:
'
UW
layouts'
class
:
'
\Drupal\uw_cfg_common\Plugin\Layout\UwTwoColumnLayout'
class
:
'
\Drupal\uw_cfg_common\Plugin\Layout\UwTwoColumnLayout'
template
:
uw_fdsu_theme_resp/templates/layout/layout--uwtwocol
template
:
uw_fdsu_theme_resp/templates/layout/layout--uwtwocol
...
@@ -23,7 +23,7 @@ uw_two_column:
...
@@ -23,7 +23,7 @@ uw_two_column:
icon_map
:
icon_map
:
-
[
first
,
second
]
-
[
first
,
second
]
uw_three_column
:
uw_three_column
:
label
:
'
UW
Three
columns'
label
:
'
Three
columns'
category
:
'
UW
layouts'
category
:
'
UW
layouts'
class
:
'
\Drupal\uw_cfg_common\Plugin\Layout\UwThreeColumnLayout'
class
:
'
\Drupal\uw_cfg_common\Plugin\Layout\UwThreeColumnLayout'
template
:
uw_fdsu_theme_resp/templates/layout/layout--uwthreecol
template
:
uw_fdsu_theme_resp/templates/layout/layout--uwthreecol
...
@@ -38,7 +38,7 @@ uw_three_column:
...
@@ -38,7 +38,7 @@ uw_three_column:
icon_map
:
icon_map
:
-
[
first
,
second
,
third
]
-
[
first
,
second
,
third
]
uw_four_column
:
uw_four_column
:
label
:
'
UW
Four
columns'
label
:
'
Four
columns'
category
:
'
UW
layouts'
category
:
'
UW
layouts'
class
:
'
\Drupal\uw_cfg_common\Plugin\Layout\UwFourColumnLayout'
class
:
'
\Drupal\uw_cfg_common\Plugin\Layout\UwFourColumnLayout'
template
:
uw_fdsu_theme_resp/templates/layout/layout--uwfourcol
template
:
uw_fdsu_theme_resp/templates/layout/layout--uwfourcol
...
@@ -54,3 +54,22 @@ uw_four_column:
...
@@ -54,3 +54,22 @@ uw_four_column:
label
:
Fourth
label
:
Fourth
icon_map
:
icon_map
:
-
[
first
,
second
,
third
,
fourth
]
-
[
first
,
second
,
third
,
fourth
]
uw_five_column
:
label
:
'
Five
columns'
category
:
'
UW
layouts'
class
:
'
\Drupal\uw_cfg_common\Plugin\Layout\UwFiveColumnLayout'
template
:
uw_fdsu_theme_resp/templates/layout/layout--uwfivecol
default_region
:
first
regions
:
first
:
label
:
One
second
:
label
:
Two
third
:
label
:
Third
fourth
:
label
:
Fourth
fifth
:
label
:
Fifth
icon_map
:
-
[
first
,
second
,
third
,
fourth
,
fifth
]
\ No newline at end of file
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