diff --git a/CHANGELOG.md b/CHANGELOG.md index ec17254..8ab3137 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p ## Unreleased +## 3.3.4 - 2019-03-01 + +### Fixed +- Fixed an issue where sometimes the fields cache needs refreshing ([#46](https://github.com/angell-co/Spoon/pull/46)) + + ## 3.3.3 - 2019-02-22 ### Fixed @@ -31,6 +37,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p ### Fixed - Reverted PR [#46](https://github.com/angell-co/Spoon/pull/46) due to large DB impact resulting in slow page loads +- Fixed an issue where Spoon was not loading on previous versions of an Entry ([#48](https://github.com/angell-co/Spoon/issues/48)) ## 3.3.0 - 2019-02-14 diff --git a/src/services/BlockTypes.php b/src/services/BlockTypes.php index 664a2aa..6f7486b 100644 --- a/src/services/BlockTypes.php +++ b/src/services/BlockTypes.php @@ -51,12 +51,21 @@ class BlockTypes extends Component // Public Methods // ========================================================================= + /** + * BlockTypes constructor. + */ + public function __construct() { + // Refresh fields cache in case something has gone awry + Craft::$app->fields->refreshFields(); + } + /** * Returns a Spoon block type model by its ID * * @param $id * - * @return null + * @return BlockType|null + * @throws BlockTypeNotFoundException */ public function getById($id) { @@ -374,7 +383,7 @@ public function getFieldLayoutIds($context, $fieldId = false) * * @param BlockTypeRecord $blockTypeRecord * - * @return null + * @return BlockType|null */ private function _populateBlockTypeFromRecord(BlockTypeRecord $blockTypeRecord) {