Skip to content

Commit

Permalink
Set buttonType to empty by default
Browse files Browse the repository at this point in the history
  • Loading branch information
piqusy committed Dec 5, 2024
1 parent 8eb3192 commit cb36884
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions blocks/init/src/Blocks/components/button/button.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
$additionalClass = $attributes['additionalClass'] ?? '';
$additionalAttributes = $attributes['additionalAttributes'] ?? [];
$buttonId = Helpers::checkAttr('buttonId', $attributes, $manifest);
$buttonType = Helpers::checkAttr('buttonType', $attributes, $manifest);

$buttonUrl = Helpers::checkAttr('buttonUrl', $attributes, $manifest);
$buttonIsNewTab = Helpers::checkAttr('buttonIsNewTab', $attributes, $manifest);
Expand Down Expand Up @@ -60,8 +61,8 @@

$buttonTag = !empty($buttonUrl) ? 'a' : 'button';

if (empty($buttonUrl)) {
$buttonAttrs['type'] = Helpers::checkAttr('buttonType', $attributes, $manifest);
if (empty($buttonUrl) && !empty($buttonType)) {
$buttonAttrs['type'] = $buttonType;
}
?>

Expand Down
2 changes: 1 addition & 1 deletion blocks/init/src/Blocks/components/button/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
},
"buttonType": {
"type": "string",
"default": "button"
"default": ""
},
"buttonColor": {
"type": "string",
Expand Down

0 comments on commit cb36884

Please sign in to comment.