-
Notifications
You must be signed in to change notification settings - Fork 82
Unify JS-Modal templates #1774
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
Unify JS-Modal templates #1774
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR standardizes modal HTML generation by using output buffering (ob_start
) instead of string concatenation and reorders attributes alphabetically for consistency.
- Converted inline string templates in
reactions
andfollow-me
toob_start
blocks. - Alphabetized input/button attributes in
remote-reply
. - Removed old concatenated string assignments for modal content.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
src/remote-reply/render.php | Reordered input/button attributes alphabetically |
src/reactions/render.php | Replaced string-concat modal HTML with an ob_start template |
src/follow-me/render.php | Converted follow-me modal HTML to an ob_start block |
build/remote-reply/render.php | Mirrored attribute reordering in build output |
build/reactions/render.php | Mirrored ob_start template conversion in build output |
build/follow-me/render.php | Mirrored ob_start template conversion in build output |
Comments suppressed due to low confidence (3)
src/reactions/render.php:139
- The newly introduced modal HTML lacks tests; consider adding unit or integration tests to verify the resulting HTML structure and bindings.
<ul class="reactions-list">
src/follow-me/render.php:108
- [nitpick] Add a comment explaining the purpose of this buffer start and how $modal_content is used by Blocks::render_modal for clarity.
ob_start();
src/follow-me/render.php:144
- [nitpick] The keydown handler name differs from
actions.onInputKeydown
used elsewhere; consider standardizing the callback naming for consistency.
data-wp-on--keydown="actions.handleKeyDown"
Not sure why I missed that previously
Unify the way we define the modal HTML. We currently have two different ways to define the modal HTML, this is
ob_start
and string concatination.I asked chatgpt about the best way to do it: "What is the best approach for mixing PHP with HTML templates: using
ob_start
,printf
, or string concatenation?"Summary
We are working with bigger HTML templates, so I think we should handle them like a templates (https://phptherightway.com/#plain_php_templates). The
ob_*
solution therefore is the most straight forward solution in terms of readability and extensibility.Proposed changes:
ob_*
.Other information:
Testing instructions:
Changelog entry
Changelog Entry Details
Significance
Type
Message