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"

Command icon 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

lohndaniel created an issue. See original summary.

lohndaniel’s picture

Assigned: lohndaniel » Unassigned
Status: Active » Needs review

I 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.

csakiistvan made their first commit to this issue’s fork.

csakiistvan’s picture

Assigned: Unassigned » csakiistvan
csakiistvan’s picture

Assigned: csakiistvan » Unassigned
Status: Needs review » Reviewed & tested by the community

✅ 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 only Linkedin, Copy Link, Facebook in weight order. All four reported problems are fixed after the setConfiguration() follow-up on the MR !4 branch.

Actual results
  • MR !4 initially removed only Twitter from defaultConfiguration(); a new block then rendered Linkedin, Pinterest, Copy Link, Facebook because the defaults were deep-merged back in.
  • The setConfiguration() override now pushed to the branch lets the saved platform list win; a block placed without configuration still gets facebook, linkedin, pinterest.
  • Blocks saved before the fix keep the extra platforms in their settings until re-saved or updated via hook_update_N.

csakiistvan changed the visibility of the branch 3581596-block-config-order-issue to hidden.

csakiistvan changed the visibility of the branch 3581596-block-configuration-not to hidden.

lohndaniel’s picture

The 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).

sujan shrestha’s picture

Version: 1.1.x-dev » 1.1.8
Status: Reviewed & tested by the community » Fixed

Fixed 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.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.