Skip to content

Commit

Permalink
Merge branch 'v3' of https://github.com/craftcms/cms into 4.3
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonkelly committed Sep 13, 2022
2 parents abf1528 + 836dd5f commit c9167f3
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
- Fixed a bug where element index filter HUDs were unresponsive if another one was already active for a different site/source. ([#11880](https://github.com/craftcms/cms/issues/11880))
- Fixed a bug where newly-created subfolders on the Assets index page could appear to have the wrong indentation.
- Fixed a UI bug where renaming a newly-created volume subfolder didn’t appear to have any effect.
- Fixed a bug where empty URL fields would be marked as changed, even when no change was made to them. ([#11908](https://github.com/craftcms/cms/issues/11908))

### Security
- Fixed XSS vulnerabilities.
Expand Down
2 changes: 1 addition & 1 deletion src/fields/Date.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ protected function inputHtml(mixed $value, ?ElementInterface $element = null): s
$timezone = $this->showTimeZone && $value ? $value->getTimezone()->getName() : Craft::$app->getTimeZone();

if ($value === null) {
// Override the initial value being set to null by _includes/forms/field
// Override the initial value being set to null by CustomField::inputHtml()
$initialValue = [];
if ($this->showDate) {
$initialValue['date'] = '';
Expand Down
2 changes: 1 addition & 1 deletion src/fields/Number.php
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ protected function inputHtml(mixed $value, ?ElementInterface $element = null): s
}
}
} else {
// Override the initial value being set to null by _includes/forms/field
// Override the initial value being set to null by CustomField::inputHtml()
$view->setInitialDeltaValue($this->handle, [
'locale' => Craft::$app->getFormattingLocale()->id,
'value' => '',
Expand Down
11 changes: 10 additions & 1 deletion src/fields/Url.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,13 +248,22 @@ protected function inputHtml(mixed $value, ?ElementInterface $element = null): s
],
]);

$view = Craft::$app->getView();

if ($value === null) {
// Override the initial value being set to null by CustomField::inputHtml()
$view->setInitialDeltaValue($this->handle, [
'type' => $valueType,
'value' => '',
]);
}

if (count($this->types) === 1) {
return
Html::hiddenInput("$this->handle[type]", $valueType) .
$input;
}

$view = Craft::$app->getView();
$namespacedId = $view->namespaceInputId($id);
$js = <<<JS
$('#$namespacedId-type').on('change', e => {
Expand Down

0 comments on commit c9167f3

Please sign in to comment.