Skip to content

Commit

Permalink
Fix errors working with plain values
Browse files Browse the repository at this point in the history
  • Loading branch information
darrenoh committed Nov 9, 2023
1 parent e6a631a commit 4d26fcf
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/Plugin/Field/FieldType/DecoratedFieldItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -364,22 +364,26 @@ public function setContext($name = null, TraversableTypedDataInterface $parent =

public function offsetExists(mixed $offset): bool
{
return array_key_exists($offset, $this->getProperties());
settype($offset, 'string');
return isset($this->inner->$offset);
}

public function offsetGet(mixed $offset): mixed
{
return $this->get($offset)->getValue();
settype($offset, 'string');
return $this->inner->$offset;
}

public function offsetSet(mixed $offset, mixed $value): void
{
$this->get((string) $offset)->setValue($value);
settype($offset, 'string');
$this->inner->$offset = $value;
}

public function offsetUnset(mixed $offset): void
{
$this->get($offset)->setValue(null);
settype($offset, 'string');
unset($this->inner->$offset);
}

/**
Expand Down

0 comments on commit 4d26fcf

Please sign in to comment.