Skip to content

Commit

Permalink
fix multiple buttons with same configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
kringkaste committed Sep 1, 2021
1 parent 6644ab9 commit 694baf3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
8 changes: 5 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Customizable Radio Buttons Field Changelog

## Unreleased
### Changed
- Fixed background color of icon
## 1.0.2 - 2021-09-01
### Fixed
- Add wrap and gap to the buttons (thanks to @emsuiko).
- Fixed background color of icon.
- Fixed a bug when two or more same configurations were used in one tab/ matrix block.

## 1.0.1 - 2019-09-15
### Fixed
Expand Down
7 changes: 4 additions & 3 deletions src/fields/Buttons.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,10 @@ public function getInputHtml($value, ElementInterface $element = null): string

$buttons = [];
foreach ($group['buttons'] as $handle => $button) {
$buttons[$handle] = array_merge($this->defaultButton, $button);
if ($buttons[$handle]['image'] !== '') {
$buttons[$handle]['image'] = Craft::$app->assetManager->getPublishedUrl($buttons[$handle]['image'], true);
$fieldHandle = $this->handle . '-' . $handle;
$buttons[$fieldHandle] = array_merge($this->defaultButton, $button);
if ($buttons[$fieldHandle]['image'] !== '') {
$buttons[$fieldHandle]['image'] = Craft::$app->assetManager->getPublishedUrl($buttons[$fieldHandle]['image'], true);
}
}

Expand Down

0 comments on commit 694baf3

Please sign in to comment.