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
f73de6fb
Commit
f73de6fb
authored
2 years ago
by
Eric Bremner
Committed by
Kevin Paxman
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
ISTWCMS-5880: updating the states for media and adding allowed value function for media width
parent
b38e9c62
No related branches found
No related tags found
3 merge requests
!284
Feature/istwcms 5880 ebremner banners above
,
!274
Draft: ISTWCMS-5551: fixing office hours display
,
!260
Feature/istwcms 5668 a5kulkar rename references to publications
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
uw_cfg_common.module
+40
-2
40 additions, 2 deletions
uw_cfg_common.module
with
40 additions
and
2 deletions
uw_cfg_common.module
+
40
−
2
View file @
f73de6fb
...
@@ -589,6 +589,41 @@ function uw_cfg_common_preprocess_node(&$variables) {
...
@@ -589,6 +589,41 @@ function uw_cfg_common_preprocess_node(&$variables) {
}
}
}
}
/**
* Get the layout builder styles as options.
*
* @param \Drupal\field\Entity\FieldStorageConfig $definition
* The field definition.
* @param \Drupal\Core\Entity\ContentEntityInterface|null $entity
* The entity being created if applicable.
* @param bool $cacheable
* Boolean indicating if the results are cacheable.
*
* @return array
* An array of possible key and value options.
*
* @see options_allowed_values()
*/
function
_uw_cfg_common_get_layout_builder_styles
(
FieldStorageConfig
$definition
,
ContentEntityInterface
$entity
=
NULL
,
$cacheable
)
{
// Get all the styles for sections.
$all_styles
=
_layout_builder_styles_retrieve_by_type
(
'section'
);
// Array of options.
$options
=
[];
// Step through each style and get the info.
foreach
(
$all_styles
as
$style
)
{
$options
[
$style
->
id
()]
=
$style
->
label
();
}
return
$options
;
}
/**
/**
* Implements hook_page_attachments().
* Implements hook_page_attachments().
*/
*/
...
@@ -925,7 +960,7 @@ function uw_cfg_common_form_alter(array &$form, FormStateInterface $form_state,
...
@@ -925,7 +960,7 @@ function uw_cfg_common_form_alter(array &$form, FormStateInterface $form_state,
];
];
// Set the states for the banner.
// Set the states for the banner.
$form
[
'
field_uw
_banner'
][
'#states'
]
=
[
$form
[
'
group
_banner'
][
'#states'
]
=
[
'visible'
=>
[
'visible'
=>
[
[
[
'select[name="field_uw_type_of_media"]'
=>
[
'select[name="field_uw_type_of_media"]'
=>
[
...
@@ -936,12 +971,15 @@ function uw_cfg_common_form_alter(array &$form, FormStateInterface $form_state,
...
@@ -936,12 +971,15 @@ function uw_cfg_common_form_alter(array &$form, FormStateInterface $form_state,
];
];
// Set the states for the banner settings.
// Set the states for the banner settings.
$form
[
'
group_banner_settings
'
][
'#states'
]
=
[
$form
[
'
field_uw_media_width
'
][
'#states'
]
=
[
'visible'
=>
[
'visible'
=>
[
[
[
'select[name="field_uw_type_of_media"]'
=>
[
'select[name="field_uw_type_of_media"]'
=>
[
[
'value'
=>
'banner'
],
[
'value'
=>
'banner'
],
],
],
'select[name="field_uw_text_overlay_style"]'
=>
[
[
'value'
=>
'full-width'
],
],
],
],
],
],
];
];
...
...
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