I found three bugs in the Better Social Share block that cause the block configuration to not be properly respected:
Problem 1: "More" button appears even when set to "none"
Steps to reproduce:
Place a Better Social Share block
In block configuration, set "More Button" to "None" (more_button: none)
View the page
Expected behavior: The "More" button should not appear.
Actual behavior: The "More" button still appears.
Root cause: In BetterSocialShareBlock::build() (line ~172), the code looks for $data['more_button_type'] but the configuration key is actually more_button (as set in submitConfigurationForm() line 512). Since the key doesn't exist, it defaults to empty string, and the template condition more_button_type != 'none' evaluates to true.
Problem 2: copy_link button ignores transparent background setting
Steps to reproduce:
Set button style to "Transparent background" (btn_type: transparent)
Enable "Copy Link" in platforms
View the page
Expected behavior: All buttons, including Copy Link, should have transparent background (class social-link-transparent).
Actual behavior: Copy Link button shows with solid background.
Root cause: In copy_link.html.twig, the button uses fixed class copy-link instead of the dynamic platform_key variable like other platforms. When btn_type is transparent, platform_key is set to 'transparent', but this is not used in the template.
Problem 3: Twitter appears unexpectedly
The default configuration in defaultConfiguration() method enables Twitter by default. If block configuration doesn't load properly, Twitter may appear even when not explicitly enabled.
Proposed fixes:
In BetterSocialShareBlock::build(), change $data['more_button_type'] to $data['more_button']
In copy_link.html.twig, add platform_key to the class attribute: class="social-link social-link-{{ platform_key }} copy-link"
Issue fork better_social_share-3581596
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
lohndaniel commentedI found another bug. Even though I set the order on the block configuration form, the icons didn't appear in the order I specified.
I pushed a possible solution to the problem in 3581596-block-config-order-issue branch.
Comment #6
csakiistvanComment #7
csakiistvan✅ Tested and works — applied MR !4 and MR !5, rebuilt caches and viewed a configured share block: no "More" button, Copy Link gets
social-link-transparent, and a freshly placed block renders onlyLinkedin, Copy Link, Facebookin weight order. All four reported problems are fixed after thesetConfiguration()follow-up on the MR !4 branch.Actual results
defaultConfiguration(); a new block then renderedLinkedin, Pinterest, Copy Link, Facebookbecause the defaults were deep-merged back in.setConfiguration()override now pushed to the branch lets the saved platform list win; a block placed without configuration still getsfacebook, linkedin, pinterest.hook_update_N.Comment #10
lohndaniel commentedThe weight-ordering fix (MR !5) has been moved to #3616132, closing MR !5 here as duplicate.
This issue now covers only the "More" button, copy_link styling and platform-leak defects (MR !4).
Comment #11
sujan shrestha commentedFixed in 1.1.8 (commit 2388a9e).
- The block reads the saved more_button setting, so "None" hides the button.
- Copy Link gets the platform class, so the transparent style applies.
- Saved platforms are no longer merged with the default platforms.
Blocks saved by older releases are repaired automatically, and the update hook stores the fix permanently. Covered by kernel tests.