I like using the conditional fields module to streamline relevant fields and workflows for content editors. I have an event content type where I'm using a smart date field, and I wanted to add a simple boolean field for "Schedule presentation", that would hide or disable the smart date field if unchecked, simplifying the UI, and only showing the date field if someone was ready or wanted to schedule a date.

When either of these options were enabled, however, attempting to save the content with the boolean unchecked (and therefore smart date either hidden or disabled) would result in a WSOD. The following was in the error log:

Referrer http://mysite.com/node/add/learning_topic
Message Error: Class "Drupal\datetime_range\Plugin\Field\FieldWidget\DateRangeWidgetBase" not found in Drupal\smart_date\Plugin\Field\FieldWidget\SmartDateWidgetBase->massageFormValues() (line 295 of /var/www/html/web/modules/contrib/smart_date/src/Plugin/Field/FieldWidget/SmartDateWidgetBase.php).

Comments

W01F created an issue. See original summary.

mandclu’s picture

Based on where that error is triggered, it seems as though the field for which you're using the Smart Date widget is neither a Smart Date field, nor a core Date Range field. What kind of field is it?

w01f’s picture

It's a "Smart date range" field. I'm including screenshots of the fields, form display, and the display using Layout Builder.

Drupal 10.0.8
Smart Date 4.0.0-rc1

mandclu’s picture

Status: Active » Needs review
StatusFileSize
new1.43 KB

Hmmm I wonder if the conditional fields module unsets the 'storage' key on the field, which is causing that clause to be triggered. Here's a patch that checks for the class that is intended to be used as a fallback, with a fallback strategy of just skipping any additional processing, which in this use case sounds like would be appropriate anyway.

w01f’s picture

Patch tested and works as expected! Tested with boolean checked and unchecked, and the dependent field filled in and left blank. All options seem to work fine now.

  • mandclu committed 216cd065 on 4.0.x
    Issue #3356452 by mandclu: Not compatible with conditional fields module
    
mandclu’s picture

Status: Needs review » Fixed

Thanks for the feedback. Merged in.

mandclu’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.