Skip to content

Commit aa3e74c

Browse files
committed
Adding addBlok method to StoryComponent data class
1 parent c7d84e4 commit aa3e74c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/Data/StoryComponent.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,12 @@ public function setAsset(string $field, Asset $asset): self
8787
$this->set($field, $asset->toArray());
8888
return $this;
8989
}
90+
91+
public function addBlock(string $field, StoryComponent $component): self
92+
{
93+
$blocks =$this->getArray($field);
94+
$blocks[] = $component->toArray();
95+
$this->set($field, $blocks);
96+
return $this;
97+
}
9098
}

0 commit comments

Comments
 (0)