When a user edits a node with a workflow, we sometimes get this:
Warning: Undefined array key "scheduled" in Drupal\workflow\Element\WorkflowTransitionTimestamp::valueCallback() (regel 52 van /data/code/jobbonus/www/modules/contrib/workflow/src/Element/WorkflowTransitionTimestamp.php)
Looking at the current code:
public static function valueCallback(&$element, $input, FormStateInterface $form_state) {
...
// Fetch $timestamp from widget for scheduled transitions.
$scheduled = (bool) $input['scheduled'] ?? '0';
if ($scheduled) {
$schedule_values = $input['date_time'];
I think changing it to this will fix the warning (and be more correct):
public static function valueCallback(&$element, $input, FormStateInterface $form_state) {
...
// Fetch $timestamp from widget for scheduled transitions.
$scheduled = (bool)($input['scheduled'] ?? false);
if ($scheduled) {
$schedule_values = $input['date_time'];
- Changing '0' to false (why an extra conversion?)
- Extra () around the expression so the coalescing happens first
Active
1.8
Code