The wrapper of the replacement pattern gets removed on using it in view footer or header.
Steps to reproduce:
- Create a block of user using views.
- Go to Headers and add textarea field.
- Check the box Use replacement tokens from the first row.
- Add HTML
<button id="edit-submit" class="add-address"><a href="/user/{{ raw_arguments.uid }} >User</a></button>inside the Content - Click apply

Expected result:
A button with HTML <button id="edit-submit" class="add-address"><a href="/user/{{ raw_arguments.uid }} >User</a></button>
Actual result:
<a href="/user/{{ raw_arguments.uid }} >User</a>
This is the dom which renders:

The button which is the wrapper of anchor automatically gets removed. when Use replacement tokens from the first row is checked.
| Comment | File | Size | Author |
|---|---|---|---|
| #26 | interdiff.txt | 808 bytes | lauriii |
| #26 | 3136107-26.patch | 2.8 KB | lauriii |
| #25 | 3136107-19.patch | 2.49 KB | spokje |
| #22 | Before--patch.jpg | 137.72 KB | ranjith_kumar_k_u |
| #22 | After--patch.jpg | 187.17 KB | ranjith_kumar_k_u |
Comments
Comment #2
daiwik.addweb commented@himanshu_sindhwani, Please try with my attached patch, I hope it will help you & provide the exact solution.
Thanks
Comment #3
himanshu_sindhwani commentedHi @roshnipateladdweb, thanks for the patch. I reviewed the patch and saw you have added a button in $adminTags, it actually solves the case partially for me. Here are my observations:
Before patch:
if I tried to add any wrapper like div or button it got removed. For e.g.
<button class='testing-wrapper'><a href='/user/{{ raw_arguments.uid }}'>Click</a></button>renders as<a href='/user/{{ raw_arguments.uid }}'>Click</a>or<div class='testing-wrapper'><a href='/user/{{ raw_arguments.uid }}'>Click</a></div>renders as<a href='/user/{{ raw_arguments.uid }}'>Click</a>After applying patch:
<button class='testing-wrapper'><a href='/user/{{ raw_arguments.uid }}'>Click</a></button>renders as<button><a href='/user/{{ raw_arguments.uid }}'>Click</a><button>and<div class='testing-wrapper'><a href='/user/{{ raw_arguments.uid }}'>Click</a></div>still renders me<a href='/user/{{ raw_arguments.uid }}'>Click</a>So, Classes and other attributes are removed from button and div is completely removed.
Comment #4
himanshu_sindhwani commentedComment #5
bunty badgujar commentedComment #6
bunty badgujar commentedHello @himanshu_sindhwani,
I don't think patch is needed for this functionality. You can configure Text formats to achieve this.
Steps:-
Comment #7
bunty badgujar commentedComment #8
himanshu_sindhwani commentedHi @bunty-badgujar, I have already placed this button under text format settings. Please focus on point 3 of the steps to reproduce and then see the results. I am not sure if you have tried to reproduce.
Comment #9
bunty badgujar commentedMy bad i must of confused with the description and #3. You can add any attribute in "Text format" after applying patch as mentioned in #6.
Can you verify this?
Comment #10
himanshu_sindhwani commentedHi @bunty-badgujar, thanks for the workaround you are right we can achieve this by applying the patch and then using full HTML as format in the text editor, but it seems very confusing which tags are allowed in textarea or Unfiltered text. I see two things here:
So, therefore, I have decided to make a patch which shows all the tags that are allowed in respective scenarios.
Comment #11
jcmartinezThank you for the work you have done on this issue.
This issue is a duplicate of https://www.drupal.org/project/drupal/issues/2657266, which was created years before. Please do a search in the issue queue before opening a new issue.
I understand that not always it's possible to find an issue and duplicates happen. In that case, try to set the relationship between issues as accurate as possible.
Comment #12
himanshu_sindhwani commentedComment #14
nod_Credit from duplicate issue, patches are made against latest development branch first, so 9.1.x right now.
This change the UI quite a bit, wouldn't mind some usability review.
If we decide a list a a good thing to have I wouldn't put the list there directly but have a link to a page that lists the tags like we do for filter tips (the "About text formats" link that points to
/filter/tips).We could also add some code to the validator function and show a message if the text contains restricted markup, that way we don't add anything to the UI for the vast majority of people.
Comment #15
generalredneckDamn decent of you sir. I never knew what happens to credit when an issue is marked as duplicate. Not that I thrive on credit... but it's nice to have :)
Comment #16
himanshu_sindhwani commentedThanks for your review @nod_ , If you add a custom Text field under fields option, this description of allowed tags is already present but missing from global custom text under header/footer. I consider this is not going to be a changes in UI and instead its an inconsistency.
Comment #17
nod_Ok if it is to make it consistent, I'd try to get closer to the existing sentences, something like:
You may enter data from this view as per the "Available global token replacements" above. You may include the following allowed HTML tags: xxxxx(with no space before ":").And the description could be updated too since "Add unrestricted, custom text or markup. This is similar to the custom text field." isn't accurate.
Comment #18
himanshu_sindhwani commentedOk thanks. I will work on that.
Comment #19
himanshu_sindhwani commentedUpdated the patch as per #18. Please review.
Comment #20
himanshu_sindhwani commentedComment #22
ranjith_kumar_k_u commentedThe last patch works fine on 9.2 dev version

Before patch
After patch

Comment #23
himanshu_sindhwani commentedComment #25
spokjeRe-uploading
3136107-19.patchso it gets tested every 2 days against9.2.x-dev.Until now it was tested against
9.1.x-dev.The failure of #24 seemed to be a random FunctionalJavascript fluke so setting back to RTBC per #23
Comment #26
lauriiiDiscussed this with @AaronMcHale, @benjifisher, @ckrina, @dardoneli, @DyanneNova and @Gábor Hojtsy in the UX call last Friday #3191695: Drupal Usability Meeting 2021-01-15. The group agreed that the current terminology could use some improvements. We reviewed the proposed changes and thought that the proposed text is too limiting since it only mentions text and link. We updated that text, as well as the description text for the filtered text area to try to make difference between the two plugins more apparent.
We also reviewed the changes for the area plugin option forms. We thought that showing the list of allowed HTML elements is a nice UX improvement since it removes any guessing from which elements are allowed.
Comment #27
spokje- Like the both new texts
- TestBot is green with pride.
Back to RTBC for me.
Comment #30
catchCommitted da3a22d and pushed to 9.2.x. Thanks! Also cherry-picked to 9.1.x.