Skip to content

Commit

Permalink
Fix #900
Browse files Browse the repository at this point in the history
  • Loading branch information
ttempleton committed Jul 2, 2024
1 parent c0f8213 commit 12394e4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## Unreleased

### Fixed
- Fixed a bug where the contents of translatable fields within new Neo blocks were not being propagated to other sites

## 4.2.5 - 2024-06-24

### Fixed
Expand Down
5 changes: 5 additions & 0 deletions src/Field.php
Original file line number Diff line number Diff line change
Expand Up @@ -1479,6 +1479,11 @@ private function _createBlocksFromSerializedData(array $value, ElementInterface
}
}

if (isset($blockData['fresh'])) {
$block->setIsFresh();
$block->propagateAll = true;
}

$blockLevel = (int)($blockData['level'] ?? $block->level);

$block->setOwner($element);
Expand Down
1 change: 1 addition & 0 deletions src/controllers/Input.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ public function actionRenderBlocks(): Response
'handle' => $namespace ?? $field->handle,
'block' => $block,
'static' => false,
'isFresh' => true,
]);

if ($autosaveDrafts && $structure !== null) {
Expand Down
3 changes: 3 additions & 0 deletions src/templates/block.twig
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@
{{ hiddenInput("#{baseInputName}[enabled]", block.enabled ? '1' : '', {'data-neo-b': blockId ~ '.input.enabled'}) }}
{{ hiddenInput("#{baseInputName}[level]", block.level, {'data-neo-b': blockId ~ '.input.level'}) }}
{{ hiddenInput("#{handle}[sortOrder][]", blockId, {'data-neo-b': blockId ~ '.input.sortOrder'}) }}
{% if isFresh ?? false %}
{{ hiddenInput("#{baseInputName}[fresh]", '1') }}
{% endif %}
{% if not isNew %}
{% do view.registerDeltaName(baseInputName) %}
{% endif %}
Expand Down

0 comments on commit 12394e4

Please sign in to comment.