Skip to content

Conversation

@sshekhar563
Copy link

@sshekhar563 sshekhar563 commented Nov 20, 2025

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_form is 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:

  1. The email form is enabled (show_email_form).
  2. The contact has either an email or assigned user.
  3. 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; ?>

@richard67
Copy link
Member

@sshekhar563 Thank you for your pull request (PR). However, it has a few issues:

  1. As it is not a bug fix but a new feature, the PR should be made for the 6.1-dev branch.
  2. 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.
  3. 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.

@richard67 richard67 added Feature Updates Requested Indicates that this pull request needs an update from the author and should not be tested. labels Nov 20, 2025
@sshekhar563
Copy link
Author

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature PR-5.4-dev Updates Requested Indicates that this pull request needs an update from the author and should not be tested.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants