Problem/Motivation
In #3121340: Fix up minor copy problems in help topics, we collected a bunch of minor issues with help topics. It has been converted to a "plan" issue with separate issues created for each problem.
alexpott found this in contact.setting_default.html.twig
<p>{% trans %}Set a site-wide contact form to be the default contact form (the form that is shown on the <em>/contact</em> URL).{% endtrans %}</p>
It's possible the /contact path is altered so might not be on /contact. I think we should link to the site wide contact form using the contact.site_page route.
Additional notes (from #10):
1. The route to /contact (e.g. the default contact form page) is contact.site_page. We don't have Twig variables set up for that route yet. (Use the existing pair of Twig variables in this topic as a guide. Both the route and the link text will need to be updated.)
2. The Goal (the sentence we are updating with this link) need to be rephrased so that the link to the contact.site_page route can be added. It needs to be rephrased in a multilingual-context-friendly way. Since we won't know the title, this is tricky! Perhaps if we link the entire parenthetical phrase, that will work, because the entire context can be translated.
Steps to reproduce
- Install the latest version of Drupal
- Install Help Topics module, or if Help Topics has been merged with Help, install Help module.
- In a code editor or IDE, locate the help topic contact.setting_default.html.twig. (Since Help Topics is being merged into Help, and the core topics are being merged into their respective modules, it may be in 1 of several places:
- core/modules/help_topics/help_topics
- core/modules/help/help_topics
- core/modules/contact/help_topics
- Looking at the Twig file (not in the UI), see if there are any mentions of the literal string
/contact. Those should be replaced with thecontact.site_pageroute using thehelp_route_link()function. As of the time of writing, there are already variables set up for this route, the variable just needs to be used to replace the remaining instance of "/contact".
Proposed resolution
Updated after review in #15.
The rendered HTML will be:
Set a site-wide contact form to be the default contact form (the form displayed on the default contact page; for example, /contact).
That shows that the URL might be /contact, but describes the page, just in case it isn't. And the whole phrase is linked, allowing for hopefully enough context for translators to make sense of it.
1. Add the following to the top of the file, above or below the current set of {% set %} statements.
{% set contact_page_link_text %}{% trans %}the form displayed on the default contact page{% endtrans %}{% endset %}
{% set contact_page_link = render_var(help_route_link(contact_page_link_text, 'contact.site_page')) %}
2. Update the paragraph immediately following the
Goal
heading to:
<p>{% trans %}Set a site-wide contact form to be the default contact form ({{ contact_page_link }}; for example, <em>/contact</em>).{% endtrans %}</p>
Remaining tasks
- Update contact.setting_default.html.twig per the proposed resolution.
- View the topic in the UI at admin/help/topic/contact.setting_default (you can use the Tugboat link in the issue to do this!) and verify the link to the default contact form in 2 places (the place you edited and the 2nd instance in the steps). (Note: Install Help Topics to see the change (or if Help Topics has been merged into Help, Help module))
- Make a patch or merge request. Note that this file may be in one of several places (see above), depending on the state of Help Topics' merge with Help.
- Review and approve
- Commit
User interface changes
None.
API changes
None.
Data model changes
None.
Release notes snippet
The contact.setting_default help topic has been updated to reflect that the path to the default contact form will be at the configured contact.site_page route and not necessarily at the "/contact" path (which is the default). Uninstall and reinstall Help Topics module or Help (if Help Topics module has already been merged with Help) to see the change.
| Comment | File | Size | Author |
|---|---|---|---|
| #29 | Setting-a-default-contact.png | 80.04 KB | shashank5563 |
| #21 | Screenshot 2023-05-12 at 8.32.48 PM.png | 189.51 KB | smustgrave |
| #6 | 3358575-befor-changes.png | 264.65 KB | rassoni |
| #6 | 3358575-after-changes.png | 260.94 KB | rassoni |
Issue fork drupal-3358575
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
amber himes matzUpdated remaining tasks to include instructions for testing.
Comment #3
andypostComment #6
rassoni commentedAfter making changes, please refer to the images below to see how the page will appear.
Comment #7
smustgrave commentedI believe this is ready.
The tasks "Uninstall/Install Help Topics (or if Help Topics has been merged into Help, Help module)" seems out of scope of the title but could be wrong.
Comment #8
amber himes matzUpdated issue summary's remaining tasks for clarity.
Looking at MR, it's doing what I suggested in the issue summary (thank you!) but I'm not crazy about the resulting grammar, now that I look at it. Going to ask for a 2nd opinion on that before we finalize this.
Thank you all for the quick MR and review.
Comment #9
smustgrave commentedWhat about
"Set a site-wide default contact form (the form show on Contact Forms)"
Comment #10
amber himes matzOh, wait a minute, I made a mistake and confused the routes. Sorry about that! The route we already have is the route to the admin page that lists all contact forms
entity.contact_form.collection. We don't have vars for the route to the default contact page (contact.site_page).Also, although I couldn't find where /contact is configurable (or maybe it's just alterable in a custom module?), apparently it is, which is why this issue exists. So we shouldn't use the literal text "/contact" or its default route title, "Contact". The title of the page will vary, depending on which contact page is configured to be the default contact page (that's what this help topic describes in fact).
Ok. So there are 2 things to note/to do:
1. The route to /contact (e.g. the default contact form page) is
contact.site_page. We don't have Twig variables set up for that route yet. (Use the existing pair of Twig variables in this topic as a guide. Both the route and the link text will need to be updated.)2. The Goal (the sentence we are updating with this link) need to be rephrased so that the link to the
contact.site_pageroute can be added. It needs to be rephrased in a multilingual-context-friendly way. Since we won't know the title, this is tricky! Perhaps if we link the entire parenthetical phrase, that will work, because the entire context can be translated. The rendered HTML could be something like:<p>Set a site-wide contact form to be the default contact form (<a href="/contact">the form that is shown at the default contact page; for example, <em>/contact</em>)</a>).</p>That shows that the URL might be /contact, but describes the page, just in case it isn't. And the whole phrase is linked, allowing for hopefully enough context for translators to make sense of it.
If we adopt that suggestion, here are the changes that need to be made to this file.
1. Add the following to the top of the file, above or below the current set of
{% set %}statements.2. Update the paragraph immediately following the
<h2>Goal</h2>heading to:I've updated the issue summary's proposed resolution with this suggestion -- but discussion and feedback is welcome!
Edit: typo: show/shown
Comment #11
amber himes matzEdited issue summary's proposed resolution to fix typo (show => shown).
Comment #12
sourabhjainI will work on #10.
Comment #13
sourabhjainI have updated the MR as per changes suggested in #10. Please review.
Comment #14
smustgrave commentedBack to RTBC.
Comment #15
amber himes matzI reviewed the merge request via the generated Tugboat instance and I see that the HTML didn't get rendered properly, as you can see here (login: admin/admin)
https://mr3958-kxepnyr9mnydxhfgeg2mnr0rewij1yfl.tugboatqa.com/admin/help...
I think this is because there's HTML in the link text, so it gets escaped when passed through
render_var(help_route_link()).I'll do some testing and figure out a better suggestion.
Comment #16
amber himes matzAlso, I rebased the MR to 10.1.x, but maybe the target branch needs be update to 11.x (I'm not sure).
Comment #17
smustgrave commentedThink if this is fixing an existing link it can go into a minor release right?
Comment #18
amber himes matzI've pushed a fix after working out a solution. I've updated the issue summary. This is ready for review and testing.
Steps to test:
Comment #19
amber himes matzComment #20
andypostrequeued, failed test looks unrelated
Comment #21
smustgrave commentedVerifying that's what I see.
Keep forgetting we have tugboat on here.
Comment #23
elberHi I just rebased please revise.
Comment #24
smustgrave commentedSeems the rebase broke something.
Comment #25
amber himes matzI'm working on rebasing onto 11.x.
Comment #26
amber himes matzFirst, I squashed the 3 commits and rebased 10.x.
Comment #27
amber himes matzComment #28
andypostAs a bug it fits into 10.1 and could be backported to 9.5.x
Comment #29
shashank5563 commentedI have tested #17 on my local. it is working as expected.

Comment #30
amber himes matzOk, looks like it's not necessary (or appropriate) for me to add this to the 11.x branch, since it's a minor bug fix that can go in to 10.1.x (hopefully). The tests are passing now after I rebased again, so this looks good for a final review.
Comment #31
andypostI think it's ready, no tests as the fix about docs
Comment #34
longwaveCommitted and pushed cb90dcce1b to 11.x (10.2.x). Thanks!