Skip to content

Commit

Permalink
Fixed #3410
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonkelly committed Oct 30, 2018
1 parent b4cb16c commit 879cb77
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-v3.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- Fixed a bug where the `ContentBehaviour` and `ElementQueryBehavior` classes could be missing some field properties. ([#3400](https://github.com/craftcms/cms/issues/3400))
- Fixed a bug where some fields within Matrix fields could lose their values after enabling the “Manage blocks on a per-site basis” setting. ([verbb/super-table/203](https://github.com/verbb/super-table/issues/203))
- Fixed a bug where HTML Purifier wasn’t being initialized with HTML 5 element support.
- Fixed a bug where it was possible to save Assets fields with the “Restrict allowed file types?” setting enabled, but no specific file types selected. ([#3410](https://github.com/craftcms/cms/issues/3410))

## 3.0.28 - 2018-10-23

Expand Down
14 changes: 14 additions & 0 deletions src/fields/Assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,20 @@ public function init()
$this->inputJsClass = 'Craft.AssetSelectInput';
}

/**
* @inheritdoc
*/
public function rules()
{
$rules = parent::rules();

$rules[] = [['allowedKinds'], 'required', 'when' => function(self $field): bool {
return (bool)$field->restrictFiles;
}];

return $rules;
}

/**
* @inheritdoc
*/
Expand Down
1 change: 1 addition & 0 deletions src/templates/_components/fieldtypes/Assets/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
checked: (option.value in field.allowedKinds)
}) }}
{% endfor %}
{{ forms.errorList(field.getErrors('allowedKinds')) }}
</div>
{% endblock %}

Expand Down

0 comments on commit 879cb77

Please sign in to comment.