Skip to content
Snippets Groups Projects
Commit 8fd1018c authored by Tim Lammar's avatar Tim Lammar Committed by Andriy Khomych
Browse files

Issue #3313232 by Tim Lammar: Date(Day)TimeComputed: Fatal error when Ajax...

Issue #3313232 by Tim Lammar: Date(Day)TimeComputed: Fatal error when Ajax call in form. (strlen() on arraay)
parent fed6226a
No related branches found
Tags 7.x-5.7
No related merge requests found
......@@ -44,6 +44,7 @@ class DateDayComputed extends TypedData {
/** @var \Drupal\Core\Field\FieldItemInterface $item */
$item = $this->getParent();
$value = $item->{($this->definition->getSetting('date source'))} ?? '';
$value = is_array($value) ? array_shift($value) : $value;
// A date cannot be created from a NULL value.
if (empty($value) || !is_string($value)) {
......
......@@ -45,6 +45,7 @@ class DateTimeDayComputed extends TypedData {
/** @var \Drupal\Core\Field\FieldItemInterface $item */
$item = $this->getParent();
$value = $item->{($this->definition->getSetting('date source'))} ?? '';
$value = is_array($value) ? array_shift($value) : $value;
// A date cannot be created from a NULL value.
if (empty($value) || !is_string($value)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment