Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Y
y_facility
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
y_facility
Merge requests
!7
fix: [
#3436043
] Update y styles defaults
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
fix: [
#3436043
] Update y styles defaults
issue/y_facility-3436043:3436043-y-styles-defaults
into
1.1.x
Overview
0
Commits
1
Pipelines
0
Changes
1
Merged
Avi Schwab
requested to merge
issue/y_facility-3436043:3436043-y-styles-defaults
into
1.1.x
1 year ago
Overview
0
Commits
1
Pipelines
0
Changes
1
Expand
Closes
#3436043
0
0
Merge request reports
Compare
1.1.x
1.1.x (base)
and
latest version
latest version
56e4cf2e
1 commit,
1 year ago
1 file
+
38
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
y_facility.install
+
38
−
0
Options
@@ -152,6 +152,10 @@ function _y_facility_update_displays_on_install() {
->
setThirdPartySetting
(
'y_lb'
,
'styles'
,
[
'colorway'
=>
'ws_colorway_blue'
,
'border_radius'
=>
'ws_border_radius_none'
,
'border_style_global'
=>
'ws_border_style_global_drop_shadow'
,
'text_alignment_global'
=>
'ws_text_alignment_global_left'
,
'button_position_global'
=>
'ws_button_position_global_inside'
,
'button_fill_global'
=>
'ws_button_fill_global_filled'
,
])
->
setThirdPartySetting
(
'layout_builder_restrictions'
,
'entity_view_mode_restriction'
,
[
'allowed_layouts'
=>
[
@@ -511,3 +515,37 @@ function y_facility_update_9003(&$sandbox = NULL) {
function
y_facility_update_9004
(
&
$sandbox
=
NULL
)
{
_y_facility_update_field_and_create
();
}
/**
* Update default Y styles options if they're empty.
*/
function
y_facility_update_9005
(
&
$sandbox
=
NULL
)
{
$entity_display_repository
=
\Drupal
::
service
(
'entity_display.repository'
);
// Update Facility content type style defaults.
$view_modes
=
$entity_display_repository
->
getViewModeOptionsByBundle
(
'node'
,
'facility'
);
foreach
(
array_keys
(
$view_modes
)
as
$view_mode
)
{
/** @var \Drupal\Core\Entity\Display\EntityViewDisplayInterface $view_display */
$view_display
=
$entity_display_repository
->
getViewDisplay
(
'node'
,
'facility'
,
$view_mode
);
if
(
$view_mode
==
'full'
)
{
$styles
=
$view_display
->
getThirdPartySetting
(
'y_lb'
,
'styles'
);
$default_styles
=
[
'colorway'
=>
'ws_colorway_blue'
,
'border_radius'
=>
'ws_border_radius_none'
,
'border_style_global'
=>
'ws_border_style_global_drop_shadow'
,
'text_alignment_global'
=>
'ws_text_alignment_global_left'
,
'button_position_global'
=>
'ws_button_position_global_inside'
,
'button_fill_global'
=>
'ws_button_fill_global_filled'
,
];
// Merge the existing styles into the default. Any exising settings will
// override the defaults. NULL values will be filtered out.
$styles
=
array_merge
(
$default_styles
,
array_filter
(
$styles
));
$view_display
->
setThirdPartySetting
(
'y_lb'
,
'styles'
,
$styles
);
}
$view_display
->
save
();
}
}
Loading