-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
[4.0] Custom fields prefix and suffix #24232
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
120b1ab
[4.0] Custom fields prefix and suffix
brianteeman 0f67ff0
namespace
brianteeman ecaa6b6
Merge branch '4.0-dev' into prefix
brianteeman 58feaeb
simplify
brianteeman 817aa8c
Merge remote-tracking branch 'origin/4.0-dev' into prefix
brianteeman 93150c6
Merge branch '4.0-dev' into prefix
wilsonge 22ce2af
Merge branch '4.0-dev' into prefix
wilsonge 6ccc23d
Merge branch '4.0-dev' into prefix
wilsonge File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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.
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.
Just from a code review perspective. I think this needs to be
<?php if (!empty($prefix)) : ?>otherwise you're going to get the span with an empty string. But if you test and tell me this works then I'm happy with that tooThere 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.
would work without empty but would raise a warning if $prefix is not defined.
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.
But would not work if $prefix is "0" (zero)
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.
The field params is a registry object, so it will default to an empty string if existing fields haven't been saved yet
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.
Tested and you do not get a span with empty string
Also tested what happens if you have a prefix and then delete the prefix - no span then either
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.
Cool! thanks!
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.
There is a point in what Harald wrote. It doesn't work if you have a prefix (eg "0") which evaluates to
false. I'm not sure if you ever get such a prefix or suffix. If you want to avoid that, one could do a checkif ($prefix !== '')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.
if prefix is 0 then you dont get a prefix (including the spans) not sure that would ever happen
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.
That's what I mean. I don't think "0" is a valid prefix or suffix. But I learned people do expect crazy things and maybe someone expects "0" to appear.
Personally, I don't mind 😄