Skip to content

Commit

Permalink
ENH Update code to reflect changes in silverstripe/admin
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli committed Nov 14, 2024
1 parent 9fad212 commit a144c4b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
8 changes: 4 additions & 4 deletions code/Controller/AssetAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use SilverStripe\Admin\CMSBatchActionHandler;
use SilverStripe\Admin\LeftAndMain;
use SilverStripe\Admin\LeftAndMainFormRequestHandler;
use SilverStripe\Admin\ModalController;
use SilverStripe\AssetAdmin\BatchAction\DeleteAssets;
use SilverStripe\AssetAdmin\Forms\AssetFormFactory;
use SilverStripe\AssetAdmin\Forms\FileFormFactory;
Expand Down Expand Up @@ -212,6 +213,7 @@ public function getClientConfig(): array
$validator = $this->getUpload()->getValidator();

$parentClientConfig = parent::getClientConfig();
$modalController = ModalController::singleton();
return array_merge($parentClientConfig, [
'reactRouter' => true,
'bustCache' => static::config()->get('bust_cache'),
Expand Down Expand Up @@ -282,12 +284,10 @@ public function getClientConfig(): array
'schemaUrl' => $this->Link('schema/fileInsertForm')
],
'remoteEditForm' => [
'schemaUrl' => LeftAndMain::singleton()
->Link('Modals/remoteEditFormSchema'),
'schemaUrl' => $modalController->Link('remoteEditFormSchema'),
],
'remoteCreateForm' => [
'schemaUrl' => LeftAndMain::singleton()
->Link('methodSchema/Modals/remoteCreateForm')
'schemaUrl' => $modalController->Link('schema/remoteCreateForm')
],
'fileSelectForm' => [
'schemaUrl' => $this->Link('schema/fileSelectForm')
Expand Down
5 changes: 3 additions & 2 deletions code/Extensions/RemoteFileModalExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Embed\Http\NetworkException;
use Embed\Http\RequestException;
use SilverStripe\Admin\FormSchemaController;
use SilverStripe\Admin\LeftAndMain;
use SilverStripe\Admin\ModalController;
use SilverStripe\AssetAdmin\Forms\RemoteFileFormFactory;
Expand Down Expand Up @@ -36,7 +37,7 @@ class RemoteFileModalExtension extends Extension
*/
protected function getRequest()
{
return $this->getOwner()->getController()->getRequest();
return $this->getOwner()->getRequest();
}

/**
Expand Down Expand Up @@ -119,7 +120,7 @@ public function remoteEditFormSchema(HTTPRequest $request)
*/
protected function getSchemaResponse($schemaID, $form = null, ValidationResult $errors = null, $extraData = [])
{
$parts = $this->getRequest()->getHeader(LeftAndMain::SCHEMA_HEADER);
$parts = $this->getRequest()->getHeader(FormSchemaController::SCHEMA_HEADER);
$data = $this
->getFormSchema()
->getMultipartSchema($parts, $schemaID, $form, $errors);
Expand Down

0 comments on commit a144c4b

Please sign in to comment.