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

Craft 4.4: Declaration of verbb\buttonbox\fields\Colours array must be compatible with craft\fields\BaseOptionsField #52

Closed
tomkiss opened this issue Feb 22, 2023 · 6 comments

Comments

@tomkiss
Copy link

tomkiss commented Feb 22, 2023

Describe the bug

Heads up - I'm testing out Craft 4.4 and I'm seeing this error with Button Box when attempting to edit a custom field in the CP.

Declaration of verbb\buttonbox\fields\Colours::translatedOptions(bool $encode = false): array 
must be compatible with 
craft\fields\BaseOptionsField::translatedOptions(bool $encode = false, mixed $value = null, ?craft\base\ElementInterface $element = null): array

Despite 4.4 still in development, I'm reporting because it seems like there may be a change on Craft's side that requires this plugin to be updated. See full 4.4 WIP Changelog here.

Please disregard if I'm mistaken! 🙂

Steps to reproduce

  1. Ensure Button Box is installed on a Craft 4.3.X instance with the ButtonBox plugin installed
  2. Upgrade to Craft 4.4
  3. Attempt to edit a custom field in the CP
  4. You should see the error

Craft CMS version

4.4.x-dev

Plugin version

4.1

Multi-site?

No response

Additional context

No response

@tomkiss
Copy link
Author

tomkiss commented Feb 22, 2023

Yeah, looks like a simple fix - updating the lines in:

  • src/fields/Buttons.php
  • src/fields/Colours.php
  • src/fields/TextSize.php
  • src/fields/Triggers.php
  • src/fields/Width.php

From:

protected function translatedOptions(bool $encode = false): array

To the new parameters of:

protected function translatedOptions(bool $encode = false, mixed $value = null, ?ElementInterface $element = null): array

...appears to fix it. But then perhaps its best to wait to see if 4.4 ships with the issue.

@engram-design
Copy link
Member

Yep, aware of this one, and will wait for Craft 4.4 to be released!

@engram-design
Copy link
Member

You can get this early, by running composer require verbb/buttonbox:"dev-craft-44 as 3.1.1"

@jacobgraf
Copy link

Just tried upgrading to Craft 4.4 and get the following error. Any idea how to fix this since 4.4 is in production now? Thanks!

Declaration of verbb\buttonbox\fields\Buttons::translatedOptions(bool $encode = false): array must be compatible with craft\fields\BaseOptionsField::translatedOptions(bool $encode = false, mixed $value = null, ?craft\base\ElementInterface $element = null): array

@engram-design
Copy link
Member

I'll get a Craft 4.4 release out shortly, but @jacobgraf you can use the above command to get the compatible code.

@engram-design
Copy link
Member

Released in 4.2.0

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

3 participants