Skip to content

Commit

Permalink
Fixed #15670
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonkelly committed Sep 5, 2024
1 parent 42eb75e commit f4bceb1
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- Fixed styling issues with Template field layout UI elements’ selector labels.
- Fixed a validation error that could occur when saving a relational field, if the “Maintain hierarchy” setting had been enabled but was no longer applicable. ([#15666](https://github.com/craftcms/cms/issues/15666))
- Fixed a PHP error that occurred when running PHP 8.2 or 8.3.
- Fixed a bug where disabled entries became enabled when edited within Live Preview. ([#15670](https://github.com/craftcms/cms/issues/15670))

## 5.4.1 - 2024-09-04

Expand Down
2 changes: 1 addition & 1 deletion src/controllers/ElementsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public function beforeAction($action): bool
$this->_draftId = $this->_param('draftId');
$this->_revisionId = $this->_param('revisionId');
$this->_siteId = $this->_param('siteId');
$this->_enabled = $this->_param('enabled', true);
$this->_enabled = $this->_param('enabled', $this->_param('setEnabled', true) ? true : null);
$this->_enabledForSite = $this->_param('enabledForSite');
$this->_slug = $this->_param('slug');
$this->_fresh = (bool)$this->_param('fresh');
Expand Down
7 changes: 7 additions & 0 deletions src/web/assets/cp/src/js/ElementEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -1648,6 +1648,12 @@ Craft.ElementEditor = Garnish.Base.extend(
);
}

for (const [name, value] of Object.entries(this.settings.saveParams)) {
params.push(
`${this.namespaceInputName(name)}=${value}`
);
}

return asArray ? params : params.join('&');
},

Expand Down Expand Up @@ -2296,6 +2302,7 @@ Craft.ElementEditor = Garnish.Base.extend(
revisionId: null,
siteId: null,
siteStatuses: [],
saveParams: {},
siteToken: null,
visibleLayoutElements: {},
updatedTimestamp: null,
Expand Down
3 changes: 3 additions & 0 deletions src/web/assets/cp/src/js/Preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,9 @@ Craft.Preview = Garnish.Base.extend(
this.$saveBtn.removeClass('loading');
},
autosaveDrafts: true,
saveParams: {
setEnabled: 0,
},
},
this.$editorContainer.data('elementEditorSettings')
)
Expand Down

0 comments on commit f4bceb1

Please sign in to comment.