Problem/Motivation
When changing background color of a section in the sidebar, the change does not reflect on the page unless the Update button is pressed.
Steps to reproduce
- Install latest version of Drupal 10 (currently 10.3.2).
- Install bootstrap_styles, bootstrap_layout_builder, and layout_builder_blocks.
- Create a new content type and enable Layout Builder for its default view display mode.
- Add Bootstrap 1 Col section and create a content block with sample text in it.
- Press "Configure Section ...", and on Style tab set any background color.
Expected behavior
Background color of the section get updated right after clicking any option in the Background color list.
Actual behavior
Background color of the section does not get updated when options in the Background color list are clicked, until the Update button is pressed. Also, if any background color was already selected for the section, it gets removed from the section until the Update button is pressed.
Proposed resolution
Fix logic for checking if the background type is image or video.
Current logic checks if $group_elements['background_video'] or $group_elements['background_image'] is not an empty string. This check always passes since these elements are arrays. This causes the video background to be incorrectly recognized when only the background color is set.
Issue fork bootstrap_styles-3468298
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
iamweird commentedComment #4
iamweird commentedI'm not sure if old check of
$group_elements['background_image']and$group_elements['background_video']for empty string is ever valid or should be preserved for a historical reason e.g. to make layouts made with previous versions work correctly.However, I decided to change check here to
is_numericinstead of comparison with empty string to better reflect actual expectation of a media ID. Advice on this matter is welcome from anyone who knows the module architecture well.Comment #5
iamweird commented