You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are seeing a notice that is filling up watchdog, and think I traced it to the fact that the WebformMetadataDate elements are not defined as composite webform elements. The notice looks like this:
Message Notice: Array to string conversion in Drupal\webform\WebformSubmissionConditionsValidator->checkConditionTrigger() (line 821 of /var/www/html/web/modules/contrib/webform/src/WebformSubmissionConditionsValidator.php)
The $element_value being checked consists of an array like this:
...whereas I think it's supposed to consist of the value of the date_type: "date_free" (in this example).
The reason this is an array rather than the value of date_type, is because in the place where it calls $element_plugin->getElementSelectorInputValue to get the value from the element, with the selector (in our example) :input[name="obj_created_date[items][0][_item_][date_type]"] , it checks to see if the webform element is composite and if so, drills into the element to get the value. However, since the WebformMetadataDate element is not defined as composite, it returns the raw value of the field, which is the array.
After discussion with @DiegoPino on Slack, we agreed that, rather than perform a major refactor to the MetadataDate elements to be composite webform elements, we would instead override the \Drupal\webform\Plugin\WebformElementBase::getElementSelectorInputValue method in \Drupal\webform_strawberryfield\Plugin\WebformElement\MetadataDateBase.
A PR for this will be forthcoming from me!
The text was updated successfully, but these errors were encountered:
We are seeing a notice that is filling up watchdog, and think I traced it to the fact that the WebformMetadataDate elements are not defined as composite webform elements. The notice looks like this:
The $element_value being checked consists of an array like this:
...whereas I think it's supposed to consist of the value of the date_type: "date_free" (in this example).
The reason this is an array rather than the value of date_type, is because in the place where it calls $element_plugin->getElementSelectorInputValue to get the value from the element, with the selector (in our example)
:input[name="obj_created_date[items][0][_item_][date_type]"]
, it checks to see if the webform element is composite and if so, drills into the element to get the value. However, since the WebformMetadataDate element is not defined as composite, it returns the raw value of the field, which is the array.After discussion with @DiegoPino on Slack, we agreed that, rather than perform a major refactor to the MetadataDate elements to be composite webform elements, we would instead override the
\Drupal\webform\Plugin\WebformElementBase::getElementSelectorInputValue
method in \Drupal\webform_strawberryfield\Plugin\WebformElement\MetadataDateBase.A PR for this will be forthcoming from me!
The text was updated successfully, but these errors were encountered: