Skip to content

Commit

Permalink
fix record reference + disable domnodesinserted
Browse files Browse the repository at this point in the history
  • Loading branch information
lekoala committed Jun 28, 2021
1 parent f00eedb commit 5bbda45
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 12 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ an array of options (for simple configs) or a string that should be the name of
## Simpler SilverStripe support

If you use Simpler SilverStripe, this module will use `DOMNodesInserted` and disable custom ajax support.
NOTE: currently disabled since there is a bug after form save.

## Config flags

Expand Down
16 changes: 8 additions & 8 deletions _config/filepond.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ SilverStripe\Assets\File:
enable_auto_thumbnails: false
extensions:
- LeKoala\FilePond\FilePondFileExtension
---
Name: filepond-simpler
After: "#simpler_silverstripe"
Only:
moduleexists: "restruct/silverstripe-simpler"
---
LeKoala\FilePond\FilePondField:
enable_ajax_init: false
# ---
# Name: filepond-simpler
# After: "#simpler_silverstripe"
# Only:
# moduleexists: "restruct/silverstripe-simpler"
# ---
# LeKoala\FilePond\FilePondField:
# enable_ajax_init: false
8 changes: 4 additions & 4 deletions javascript/FilePondField.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ document.addEventListener("DOMContentLoaded", function () {
initFilePond();
attachFilePond();
});
document.addEventListener("DOMNodesInserted", function () {
initFilePond();
attachFilePond();
});
// document.addEventListener("DOMNodesInserted", function () {
// initFilePond();
// attachFilePond();
// });
2 changes: 2 additions & 0 deletions src/AbstractUploadField.php
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,8 @@ public function Field($properties = array())
/**
* Gets the upload folder name
*
* Replaces method from UploadReceiver to provide a more flexible default
*
* @return string
*/
public function getFolderName()
Expand Down
3 changes: 3 additions & 0 deletions src/FilePondField.php
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,9 @@ public function chunk(HTTPRequest $request)
fclose($outputFile);

// Finalize real filename

// We need to class this as it mutates the state and set the record if any
$relationClass = $this->getRelationAutosetClass(null);
$realFilename = $this->getFolderName() . "/" . $uploadName;
if ($this->renamePattern) {
$realFilename = $this->changeFilenameWithPattern(
Expand Down

0 comments on commit 5bbda45

Please sign in to comment.