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

[10.x] Make ComponentAttributeBag JsonSerializable #48338

Merged
merged 4 commits into from
Sep 8, 2023
Merged

[10.x] Make ComponentAttributeBag JsonSerializable #48338

merged 4 commits into from
Sep 8, 2023

Conversation

iamgergo
Copy link
Contributor

@iamgergo iamgergo commented Sep 8, 2023

Currently it is not possible to automatically convert to array or JSON serialize the ComponentAttributeBag, but in some cases it would be handy.

json_encode(['attributes' => new ComponentAttributeBag(['class' => 'form-control'])]);

// {"attributes":{}}

We can use (new ComponentAttributeBag(['class' => 'form-control']))->getAttributes(), but it would be a better DX to handle this automatically, in my opinion.

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

Successfully merging this pull request may close these issues.

None yet

2 participants