Commit d6d02e49 authored by bojanz's avatar bojanz
Browse files

Account for StateItem::setValue() receiving a scalar.

parent 7eb6e188
......@@ -142,6 +142,10 @@ class StateItem extends FieldItemBase implements StateItemInterface, OptionsProv
public function setValue($values, $notify = TRUE) {
if (empty($this->initialValue)) {
// If no array is given, then the method received just the state value.
if (isset($values) && !is_array($values)) {
$values = ['value' => $values];
// Track the initial field value to allow isValid() to validate changes.
$this->initialValue = $values['value'];
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment