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.
Methods in the new ConditionalFieldsFormHelper
class are generally static. Let's stop doing that so that we can instantiate objects of that class.
This is a follow-up issue to #2926132: OOify contents of conditional_fields.api.inc and then delete it. Please see that issue for background information.
Comment | File | Size | Author |
---|---|---|---|
#10 | interdiff.txt | 1.69 KB | ergonlogic |
#10 | conditional_fields-make_helper_class_instantiable-3077803-10.patch | 17.49 KB | ergonlogic |
|
Comments
Comment #2
haskweb CreditAttribution: haskweb at Smile commentedComment #3
colan#2: Thanks for offering to work on this!
I don't see any patch here so this should still be Active. Fixing status.
Comment #4
ergonlogic@haskweb Have you made any progress on this?
To make quicker progress on #1161314: Add basic Field Group support for ANDing conditions, it'd be handy to be able to refactor
ConditionalFieldsFormHelper::afterBuild()
. But without instance vars, this'd be nearly pointless.Comment #5
colanAnyone if free to take this over as there's been no update in a while.
Comment #6
ergonlogicWe've got this working, though a number of the methods remains static at the moment. We'll continue re-factoring
ConditionalFieldsFormHelper
in #1161314: Add basic Field Group support for ANDing conditions.Patch forthcoming.
Comment #7
llamechPatch attached.
Comment #8
llamechHere's an updated patch with further cleanup.
Comment #9
colanThe first line here is producing this on node edit pages with conditional fields (probably where there are no dependees):
I personally like method chaining, but I'm happy either way so feel free to skip it. So if all of these methods return
$this
, we can do:return $this->processDependentFields()->addJavascriptEffects()->addValidationCallback()->form;
Overall, seems to work well in my tests except for the undefined-index error above.
Comment #10
ergonlogicI had committed a fix for the "undefined index" warning over in #1161314: Add basic Field Group support for ANDing conditions. I've cherry-picked it here.
I also added the fluent style, as suggested.
Comment #11
ergonlogicComment #13
colanMuch better.
Comment #15
colan