Skip to content
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

WIP: POC fix for dev/core#5571. #416

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

twomice
Copy link

@twomice twomice commented Nov 6, 2024

Reference issue: https://lab.civicrm.org/dev/core/-/issues/5571

  • This solves the stated problem (upon validation of required checkbox/radio fields), and my own initial, manual, testing shows it doesn't break validation of required fields of other types.

Other thoughts:

  • I'm unfamiliar with the packages/ repo. Is a PR here even a reasonable thing to do?
  • Adding params to a method doesn't "feel great", but this is just a POC.
  • I'm unsure whether an equivalent fix would be relevant for similar method in these places:
    • packages/_ORIGINAL_/HTML/QuickForm/Renderer/ITStatic.php
    • packages/_ORIGINAL_/HTML/QuickForm/Renderer/ArraySmarty.php
    • packages/HTML/QuickForm/Renderer/ITStatic.php

Copy link

civibot bot commented Nov 6, 2024

(Standard links)

@civibot civibot bot added the master label Nov 6, 2024
@totten
Copy link
Member

totten commented Jan 3, 2025

I'm unfamiliar with the packages/ repo. Is a PR here even a reasonable thing to do?

It depends on the package. For HTML_QuickForm, yes. Upstream hasn't released in years.

I'm unsure whether an equivalent fix would be relevant for similar method in these places:

  • packages/ORIGINAL/HTML/QuickForm/Renderer/ITStatic.php
  • packages/ORIGINAL/HTML/QuickForm/Renderer/ArraySmarty.php

These files (_ORIGINAL_) are just copies of the original/upstream repo. They don't need to be edited.

  • packages/HTML/QuickForm/Renderer/ITStatic.php

As far as I can tell, there's nothing in core or universe that calls out to ITStatic. TBH, we could just as well delete half the items in HTML/QuickForm/Renderer/...

Adding params to a method doesn't "feel great", but this is just a POC.

I can see how it might feel awkward -- the name suggests a kind of central function. But I think I agree it's OK. When I dig around for references to this method, it really does seem like (1) it's not a substantive part of the inheritance hierarchy and (2) it's only got the one internal caller.


However, I'm finding the change to be regressive elsewhere, i.e.

  • Setup your test as in the description
  • Note the profile
  • Open the profile as a standalone page - eg civicrm/profile/edit?gid=12&reset=1
  • Fill in everything - but leave the checkboxes all blank
  • Submit the profile.

For the standalone profile page, it worked before the patch. But with the patch, checkboxes go MIA. Compare:

  • Before/Expected
    Screenshot from 2025-01-02 16-29-16

  • After/MIA
    Screenshot from 2025-01-02 16-27-56

eileenmcnaughton added a commit to eileenmcnaughton/civicrm-core that referenced this pull request Jan 3, 2025
…alues

This does the same as civicrm/civicrm-packages#416
but in Civi code rather than in packages.

My take on it is that the original sin is that the quickform class for rendering
radio options does not nest them in a div / allow us to add classes to that div
and hence we are working around it by rendering the radio options
individually in the template layer.

If we fix that maybe we revert this - it is mostly a case of
registering a class with more suitable markup in
HTML_QuickForm::registerElementType()
@eileenmcnaughton
Copy link
Contributor

I've added a variant of this here - https://github.com/civicrm/civicrm-core/pull/31705/files#diff-5a429c6ee446ea34fcc58e2cf1e84a8befea3239e8519ebe59b32d335761b836R87

it is probably a bit narrow in that it only works on ones with the options_in_line configured - but it not in packages - still thinking there is another soluttion tho

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants