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

Refactor: update text block conversion to use text block type #7697

Merged
merged 5 commits into from
Feb 7, 2025

Conversation

jonwaldstein
Copy link
Contributor

@jonwaldstein jonwaldstein commented Jan 24, 2025

Resolves GIVE-2163

Description

This updates the text block conversion to use the first class TextBlockType.

This is the first in series approach to moving away from the untyped $block->getAttribute() and toward specific block types with typed block attributes in the form of object properties.

This also caught and fixes an issue with the BlockType class so it will always cast values as intended. So if you are expecting a boolean and for some reason the block does not have the attribute it will still return a boolean type instead of null. This makes sure the block type property types are always valid types and can be confidently used in typed methods in the fields api.

Affects

  • Custom text block fields in the VFB

Visuals

N/A

Testing Instructions

  • Make sure new and existing custom text blocks work as expected on v3 forms

Pre-review Checklist

  • Acceptance criteria satisfied and marked in related issue
  • Relevant @unreleased tags included in DocBlocks
  • Includes unit tests
  • Reviewed by the designer (if follows a design)
  • Self Review of code and UX completed

Sorry, something went wrong.

@jonwaldstein jonwaldstein marked this pull request as ready for review January 24, 2025 19:44
@jonwaldstein jonwaldstein requested a review from alaca February 7, 2025 15:23
Copy link
Member

@alaca alaca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love the idea of having block types. Looks good 👍

@jonwaldstein jonwaldstein merged commit 38f4a79 into develop Feb 7, 2025
20 checks passed
@jonwaldstein jonwaldstein deleted the refactor/use-text-block-type branch February 7, 2025 18:47
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