This repository was archived by the owner on Jul 28, 2023. It is now read-only.
Repository navigation
Process directive attributes with a colon (e.g. wp-bind:value) - #151
Merged
Merged
Conversation
DAreRodz
commented
Feb 16, 2023
ockham
reviewed
Feb 16, 2023
Comment on lines
+33
to
+38
| // Helper that removes the part after the colon before looking | ||
| // for the directive processor inside `$attribute_directives`. | ||
| $get_directive_type = function ( $attr ) { | ||
| return strtok( $attr, ':' ); | ||
| }; | ||
|
|
Collaborator
There was a problem hiding this comment.
Should we maybe move this outside wp_process_directives's function definition so we don't re-define the $get_directive_type ever so often?
Collaborator
Author
There was a problem hiding this comment.
Would it be fine if we create a global function just for that? That feels weird, haha. 😅
Anyway, we can do it in another PR if you think is worth it. 👍
ockham
approved these changes
Feb 16, 2023
ockham
left a comment
Collaborator
There was a problem hiding this comment.
Nice find! I think I probably messed something up in #144 with regard to this kind of directive.
Great to have it fixed, and covered by a unit test 🎉 Also confirming that the test fails if I don’t apply the fix ✅ Thank you very much!
I left two minor suggestions -- otherwise LGTM!
Co-authored-by: Bernie Reiter <ockham@raz.or.at>
Collaborator
Author
|
Thanks for your review and feedback, @ockham! 🙏 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The title is self-explanatory. 🙂
Why
Right now, directives using a colon are not processed and thus ignored because they're not found inside
$attribute_directives:https://github.com/WordPress/block-hydration-experiments/blob/b3df431c3436bb5f41fede36b9307cd5d770dd67/wp-directives.php#L219-L224
How
Simply filtering the colon and the part that follows from attributes before doing the search.