mirror of
https://github.com/colymba/GridFieldBulkEditingTools.git
synced 2024-10-22 11:05:57 +02:00
FIX: X-Include-JS requirements load order
UploadField.js was always loaded last, causing the new template not to load and crashing the whole thing. Simply calling the forTemplate() method earlier, makes all the Form's requirements (including UploadField.js) being loaded first
This commit is contained in:
parent
0567bb0841
commit
8a4066bef9
@ -224,13 +224,15 @@ class GridFieldBulkImageUpload_Request extends RequestHandler {
|
||||
$form->Backlink = $one_level_up->Link;
|
||||
}
|
||||
|
||||
// add these custom requirement after the UploadField is called -> depends on tmpl.js loaded with UploadField (avoid crashing)
|
||||
// seems to fix some styling issue as well?
|
||||
// this actually fixes the JS Requirements issue.
|
||||
// Calling forTemplate() before other requirements forces SS to add the Form's X-Include-JS before
|
||||
$formHTML = $form->forTemplate();
|
||||
|
||||
Requirements::javascript('GridFieldBulkImageUpload/javascript/GridFieldBulkImageUpload.js');
|
||||
Requirements::css('GridFieldBulkImageUpload/css/GridFieldBulkImageUpload.css');
|
||||
Requirements::javascript('GridFieldBulkImageUpload/javascript/GridFieldBulkImageUpload_downloadtemplate.js');
|
||||
|
||||
$response = new SS_HTTPResponse($form->forTemplate());
|
||||
$response = new SS_HTTPResponse($formHTML);
|
||||
$response->addHeader('Content-Type', 'text/plain');
|
||||
$response->addHeader('X-Title', 'SilverStripe - Bulk '.$this->gridField->list->dataClass.' Image Upload');
|
||||
return $response;
|
||||
|
Loading…
Reference in New Issue
Block a user