diff --git a/src/services/BlockTypes.php b/src/services/BlockTypes.php index 389ad41..9b21ee1 100644 --- a/src/services/BlockTypes.php +++ b/src/services/BlockTypes.php @@ -207,10 +207,14 @@ public function save(BlockType $blockType) try { // Save it! + $isNew = $blockTypeRecord->getIsNewRecord(); $blockTypeRecord->save(false); + if ($isNew) { + $blockType->id = $blockTypeRecord->id; + } // Might as well update our cache of the block type group while we have it. - $this->_blockTypesByContext[$blockType->context] = $blockType; + $this->_blockTypesByContext[$blockType->context][$blockType->id] = $blockType; $transaction->commit();