[6.1] Feature: Add conditional check for email form heading in com_contact default.php
Summary #46445
This pull request adds a conditional check before rendering the email form heading in
components/com_contact/tmpl/contact/default.php.
Problem
The email form heading (COM_CONTACT_EMAIL_FORM) is currently rendered unconditionally.
This causes the heading to appear even when the email form itself is hidden or disabled.
Examples:
- When
show_email_formis disabled. - When contact has no email assigned.
- When templates or accessibility rules require hiding the heading.
This leads to unnecessary UI output and inconsistent layout behavior.
What This PR Changes
The email form heading is now displayed only when:
- The email form is enabled (
show_email_form). - The contact has either an email or assigned user.
- A new optional parameter
show_email_heading(default: 1) is enabled.
Implementation
Wrapped the heading inside a new conditional block:
<?php if ($tparams->get('show_email_heading', 1)) : ?>
<<?= $htag2 ?>><?= Text::_('COM_CONTACT_EMAIL_FORM') ?></<?= $htag2 ?>>
<?php endif; ?>
@sshekhar563 Thank you for your pull request (PR). However, it has a few issues:
- As it is not a bug fix but a new feature, the PR should be made for the 6.1-dev branch.
- Your code style is not nice (indentation of the PHP id and endif). Please check your changes on GitHub here https://github.com/joomla/joomla-cms/pull/46477/files and verify with other places in that file.
- I think this PR is not complete. It adds the check for the new parameter "show_email_heading'", but it does not add the parameter to some form. Where does that parameter come from?
Please check and fix or let us know if you have questions.
Thanks in advance.
Hi @richard67 , thank you for your review and feedback. You’re right on all points. I will update the PR accordingly:
-
Wrong target branch Since this is a new feature (not a bug fix), I will reopen the PR against the 6.1-dev branch instead of 5.4-dev.
-
Code style I will fix the indentation and formatting using Joomla’s PHPCS standard so the file matches the rest of the codebase.
-
Missing parameter definition I added the check for show_email_heading, but I did not add the parameter to the XML configuration. I will add the parameter field in the appropriate XML file so the feature is complete.
I will push an updated version shortly. Thanks again for the guidance!
Hi @richard67 , thank you for your review and feedback. You’re right on all points. I will update the PR accordingly:
1. Wrong target branch Since this is a new feature (not a bug fix), I will reopen the PR against the 6.1-dev branch instead of 5.4-dev. 2. Code style I will fix the indentation and formatting using Joomla’s PHPCS standard so the file matches the rest of the codebase. 3. Missing parameter definition I added the check for show_email_heading, but I did not add the parameter to the XML configuration. I will add the parameter field in the appropriate XML file so the feature is complete.I will push an updated version shortly. Thanks again for the guidance!
@sshekhar563 As I have not seen any new PR yet, I have allowed myself now to rebase this PR to 6.1-dev.
The other things I had mentioned still need to be fixed.
Hi @richard67,
Thank you for your detailed review and feedback! I've addressed all the issues you mentioned:
✅ Target Branch: Created new PR targeting 6.1-dev instead of 5.4-dev
✅ Code Style: Fixed indentation and formatting to match Joomla's PHPCS standards
✅ Missing Parameter: Added show_email_heading parameter to the XML configuration with proper language strings
I've created a new pull request with all the requested changes: #46580
The new implementation includes:
- Proper XML parameter definition in
administrator/components/com_contact/forms/contact.xml - Language strings in
administrator/language/en-GB/com_contact.ini - Clean conditional check with proper formatting in the template
- Backward compatibility (defaults to enabled)
Closing this PR in favor of the new one that targets the correct branch and includes all improvements.
Thanks again for the guidance!