Skip to content

Commit

Permalink
NEW Use embed/embed v4
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Feb 28, 2022
1 parent 546d37e commit 61ee159
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 5 deletions.
9 changes: 9 additions & 0 deletions code/Exceptions/InvalidUrlException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

namespace SilverStripe\AssetAdmin\Exceptions;

use Exception;

class InvalidUrlException extends Exception
{
}
5 changes: 3 additions & 2 deletions code/Extensions/RemoteFileModalExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

namespace SilverStripe\AssetAdmin\Extensions;

use Embed\Exceptions\InvalidUrlException;
use Embed\Http\NetworkException;
use Embed\Http\RequestException;
use SilverStripe\Admin\LeftAndMain;
use SilverStripe\Admin\ModalController;
use SilverStripe\AssetAdmin\Forms\RemoteFileFormFactory;
Expand Down Expand Up @@ -100,7 +101,7 @@ public function remoteEditFormSchema(HTTPRequest $request)
try {
$form = $this->remoteEditForm();
return $this->getSchemaResponse($schemaID, $form);
} catch (InvalidUrlException $exception) {
} catch (NetworkException | RequestException $exception) {
$errors = ValidationResult::create()
->addError($exception->getMessage());
// @todo - Don't create dummy form (pass $form = null)
Expand Down
2 changes: 1 addition & 1 deletion code/Forms/RemoteFileFormFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace SilverStripe\AssetAdmin\Forms;

use Embed\Exceptions\InvalidUrlException;
use InvalidArgumentException;
use SilverStripe\AssetAdmin\Exceptions\InvalidUrlException;
use SilverStripe\Control\Director;
use SilverStripe\Control\RequestHandler;
use SilverStripe\Core\Config\Configurable;
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"license": "BSD-3-Clause",
"require": {
"php": "^7.4 || ^8.0",
"silverstripe/framework": "^4.10",
"silverstripe/framework": "^4.11",
"silverstripe/admin": "^1.7",
"silverstripe/graphql": "^3.5 || ^4"
},
Expand Down
4 changes: 3 additions & 1 deletion tests/php/Forms/RemoteFileFormFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

namespace SilverStripe\AssetAdmin\Tests\Forms;

use Embed\Exceptions\InvalidUrlException;
use Embed\Http\NetworkException;
use Embed\Http\RequestException;
use SilverStripe\AssetAdmin\Exceptions\InvalidUrlException;
use SilverStripe\AssetAdmin\Forms\RemoteFileFormFactory;
use SilverStripe\AssetAdmin\Tests\Forms\RemoteFileFormFactoryTest\MockEmbed;
use SilverStripe\Core\Injector\Injector;
Expand Down

0 comments on commit 61ee159

Please sign in to comment.