Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
As this module works with form fields that are empty, and most forms are prompting people to input information, it would be lovely to be able to highlight ( or even lowlight ) those fields for which no user input has been submitted.
Just a thought.
Cheers
Comment | File | Size | Author |
---|---|---|---|
#6 | empty_fields.class_.1884544.5.patch | 4.42 KB | TwoD |
Comments
Comment #1
Alan D. CreditAttribution: Alan D. commentedUnless someone can think of an easy clean way to implement this, I'm marking as won't fix. (I tried 3 or 4 ways, but the classes were not coming through)
Comment #2
vadym.kononenko CreditAttribution: vadym.kononenko commentedCould we do it on client side through JS?
Comment #3
TwoDHere's an implementation which doesn't rely on JS, and it could allow things like themes to check if this module considers a field empty by looking for the extra flag on field.
Comment #4
Alan D. CreditAttribution: Alan D. commentedNice, this approach looks good, but a few changes.
1) Skip "'#empty_fields_is_empty' => TRUE," for just "if (!empty($variables['element']['#empty_fields_empty_class'])) {"?
2) Possible security hole?
3) Tiny decluttered...
Attached is a totally untested patch.
Comment #5
Alan D. CreditAttribution: Alan D. commented...missed a bit in that 5 min hack. Having to run for some takeout (dinner time here) before going back to a clients project again.
Let me know if it is good or bad to keep or remove, regarding point #1.
Without the checkbox, simply checking empty_fields_handler != '' for the empty class visibility maybe?
Comment #6
TwoD1) Agreed, just looking at if a class gets set simplifies it.
2) Indeed, I assumed that array passed through
drupal_attributes()
, good catch.Added a row to the summary when a class gets set, completed the renaming to
$state_trigger_prefix
, removed the extra checkbox in favor of just checking if the class list is empty, now splitting the string on spaces and running each segment throughdrupal_html_class()
instead of check_plain(), and some minor cleanups.Comment #8
Alan D. CreditAttribution: Alan D. commentedNice. I done some local testing with no issues seen and it does what it is meant to.
Pushed through :)