Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Button Box not showing correct state after being saved within Vizy component #51

Closed
tomkiss opened this issue Oct 14, 2022 · 5 comments
Closed

Comments

@tomkiss
Copy link

tomkiss commented Oct 14, 2022

Describe the bug

I have a buttonbox field saved as a button configuration, and the field is stored within a Vizy component type.

When the entry is saved, the value is stored and correctly outputs in the front-end twig template.

However, when editing the entry again, the UI is not correctly showing the selected button; instead, simply shows the default as being selected.

Steps to reproduce

  1. Create a buttonbox field type with button configuration
  2. Place the field within a vizy component
  3. Save an entry with the component that has the buttonbox field in
  4. Verify that the value is saved but that the edit entry UI is not correctly showing which value has been saved

Having looked at the plugin source code, it seems that the code for this field is incorrectly reporting that the Vizy component "isFresh", when it's not.
If I edit line 159 of src/fields/Buttons.php and remove:

// If this is a new entry, look for a default option
if ($this->isFresh($element)) {
  //$value = $this->defaultValue(); // line removed
}

...then the bug no longer occurs.

Craft CMS version

4.2.7

Plugin version

4.1.0

Multi-site?

No

Additional context

No response

@tomkiss tomkiss changed the title Button Box not showing correct state after being saved Button Box not showing correct state after being saved within Vizy component Oct 14, 2022
@stursby
Copy link

stursby commented Feb 15, 2023

Also having this same bug.

On the following versions:

  • Craft 4.3.9
  • Button Box 4.1.0
  • Vizy 2.0.10

@engram-design
Copy link
Member

Yeah, this is to do with the slightly odd way of setting up default values for the field with isFresh(). Looking through it, it probably need a good cleanup and revision.

@bytewise
Copy link

I'm encountering the same problems when using it in combination with the Hyper plugin.

I'm using:

  • Craft 4.4.16.1
  • Button Box 4.2.0
  • Hyper 1.1.10

@engram-design Any idea when you have the time to look into this? Would love to use this in my project.

@engram-design
Copy link
Member

Should be fixed in the respective plugin's upcoming releases. To get this early run:

  • composer require verbb/hyper:"dev-craft-4 as 1.1.10"
  • composer require verbb/vizy:"dev-craft-4 as 2.1.7"

@engram-design
Copy link
Member

Fixed also in 4.2.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants