-
Notifications
You must be signed in to change notification settings - Fork 330
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
Add possibility for query parameters in sulu link #6440
Merged
alexander-schranz
merged 7 commits into
sulu:2.x
from
exastion:enhancement/sulu-link-query-parameter
Jan 24, 2022
Merged
Changes from 3 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
2be1b72
Added parsing of query parameters in <sulu-link>
exastion 252da56
Use explode instead of regex
exastion 3ec08d0
Added Test for query parameter
exastion a179a30
Fixed split order of href
exastion aca2d4f
Added Test with query string in anchor
exastion e4d85b9
Fixed array access if uuid not present
exastion 6c66fd0
Fixed possible array access on boolean
exastion 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 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 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.
@exastion Something like
my.url/#hello?page=1
means thathello?page=1
is the value of the anchor and it still a valid anchor. This is as example used in Single Page Application and are valid anchors. Sulu example use this kind of special anchor for frontend navigation.That's why its important first to split the string by
#
and then go with split the first part by?
and not the other way around. So there is no problem also from backward compatibility we are not allowed to change to seperate attributes and as said its not really required.So the following examples should show you best how the end result should look like:
See https://3v4l.org/j94IN#v7.2.34 how to correctly split the string. A
?
is a valid symbol as part of the anchor so we first need to split by#
and then split the part before the anchor by#
.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.
I did not know about these specifics up to now, I even thought in the beginning, query and anchor would be the other way around.. Well you always learn :)
This made things also easier.
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.
Also nice to know the
#anchor
is never send to a server its only available for the browser. So if your browser requestshttps://sulu.io/services/support#chat
a request is only send tohttps://sulu.io/services/support
and browsers is handling#chat
to scroll to the correct part. Or a javascript library is handling the#anchor
like its done in the sulu admin.