Fixes#3332.
FileUpload widget uploads file to the disk specified by default in config/filesystem.php instead of storage.uploads.disk in config/cms.php, if we use System\Models\File following the instruction in here.
Although we can still create another class extending System\Models\File or October\Rain\Database\Attach\File and use it as the model for attachOne/Many relation, System\Models\File seems to be the one that responsible to look at storage.uploads.disk in config/cms.php, because the existing methods are using storage.uploads.*.
Credit to @pikanji
Credit to @alxy
In case a new administrator is created by a non-superuser and no permission is set directly on creation, `permissions` is not initialized correctly. Thus, when the non-superuser tries to acceess `$this->model->permissions` it is not populated with an empty array as expected.
I have actually no clue why it does work for superusers however, as they should certainly experience the same issue, but this is not the case.
Fixes#3315 by moving the manipulation of the filter widget scopes to the controller event method instead of before any part of the controller constructor method is run.
Add `data-input-preset-remove-stop-words="false"` to an element being handled with the input preset JS to disable the removal of stop words from slug generation. Credit to @tim0991.
This enables arbitrary form contexts to be defined to override the default values when using a form with custom contexts. I.e. `$this->update($id, 'mycustomcontext');` will load the form definition from `mycustomcontext[form]` instead of `update[form]`
This aligns better with the relation principal "parent saves child" / "child cannot save parent" and is more conducive to the natural workflow of a coder, ie
// Relation first
$gallery = new Gallery;
$gallery->save();
// Primary model last
$post = new Post;
$post->gallery = $gallery;
$post->save();
Refs https://github.com/octobercms/library/pull/277
This fixes a small issue where the form is submitted an extra unnamed null field is present in the request due to a trailing & symbol in `requestData` when `data` is empty.
This logic could have been placed in the ValidationException class or the framework.js file. It seems more fitting for it to be in the framework.js file.
Converts a field name in the form of `model_json_attribute[subproperty]` to the dot syntax version used by validation rules `model_json_attribute.subproperty` for more accurate checking of the validation rules in the form widget.
This fixes#2613 by reloading the form widgets with the modified data after `model.filterFields`. **NOTE**: `$this->processExistingItems()` isn't simply just moved to `prepareVars()` because that messes up the adding new repeater item functionality by repeating the content from the fields for the last item in that group that already exists on the repeater.