diff --git a/CHANGELOG.md b/CHANGELOG.md index bf718eaf..63c92c51 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ ## Changelog +#### v1.3.2 +- `Fixed` Fixed bug with live preview mode breaking for Neo fields in Craft 2.6.2793 +- `Fixed` Fixed bug with entry drafts not updating their Neo block field values after saving +- `Fixed` Fixed bug where Neo blocks would share caches across differing host names + #### v1.3.1 - `Fixed` Fixed incompatibility with PHP 5.5 and below introduced in `1.3.0` - `Fixed` Fixed bug where leaving editing an element would always show the confirm dialog, regardless if anything changed diff --git a/neo/NeoPlugin.php b/neo/NeoPlugin.php index 0d8cf881..7efd624e 100644 --- a/neo/NeoPlugin.php +++ b/neo/NeoPlugin.php @@ -22,7 +22,7 @@ public function getDescription() public function getVersion() { - return '1.3.1'; + return '1.3.2'; } public function getCraftMinimumVersion() diff --git a/neo/fieldtypes/NeoFieldType.php b/neo/fieldtypes/NeoFieldType.php index 142f56b2..a057e17f 100644 --- a/neo/fieldtypes/NeoFieldType.php +++ b/neo/fieldtypes/NeoFieldType.php @@ -739,12 +739,16 @@ private function _getBlockHtml(Neo_BlockTypeModel $blockType, Neo_BlockModel $bl $errors = $block ? $block->getAllErrors() : []; $hasErrors = !empty($errors); $fullNamespace = craft()->templates->namespaceInputName($namespace, craft()->templates->getNamespace()); + $owner = $block ? $block->getOwner() : null; - $cacheKey = implode(':', ['neoblock', + $cacheKey = implode('|', ['neoblock', $blockType->id, $block ? $block->id : '', + $owner ? $owner->dateUpdated->getTimestamp() : '', $fullNamespace, - $static ? 's' : '', + $static ? '1' : '0', + craft()->request->isSecureConnection() ? '1': '0', + craft()->request->getHostName(), ]); $tabsHtml = $hasErrors ? false : craft()->cache->get($cacheKey); diff --git a/neo/models/Neo_CriteriaModel.php b/neo/models/Neo_CriteriaModel.php index a64bc1f3..d2f12846 100644 --- a/neo/models/Neo_CriteriaModel.php +++ b/neo/models/Neo_CriteriaModel.php @@ -79,6 +79,23 @@ public function copy() return $copy; } + /** + * Returns the total number of elements matched by this criteria. + * Fixes live preview mode which broke in Craft 2.6.2793 due to this method. If live preview mode is detected, it + * uses the old method which worked in live preview mode. + * + * @return int + */ + public function count() + { + if(craft()->request->isLivePreview()) + { + return count($this->find()); + } + + return parent::count(); + } + /** * Sets a filter value for the criteria model, then reruns Live Preview filtering. * diff --git a/package.json b/package.json index d6ca63e7..09e954eb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "craft-neo", - "version": "1.3.1", + "version": "1.3.2", "description": "A Matrix-like field type that uses existing fields", "main": "webpack.config.js", "scripts": {