Skip to content

Commit

Permalink
API Deprecate methods on RemoteFileModalExtension
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli committed Nov 25, 2024
1 parent 333b9ac commit 44e88c0
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions code/Extensions/RemoteFileModalExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use SilverStripe\Core\Convert;
use SilverStripe\Core\Extension;
use SilverStripe\Core\Injector\Injector;
use SilverStripe\Dev\Deprecation;
use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\Form;
use SilverStripe\Forms\Schema\FormSchema;
Expand All @@ -33,17 +34,21 @@ class RemoteFileModalExtension extends Extension

/**
* @return HTTPRequest
* @deprecated 2.4.0 Use $this->getOwner()->getRequest() instead.
*/
protected function getRequest()
{
return $this->getOwner()->getController()->getRequest();
Deprecation::notice('2.4.0', 'Use $this->getOwner()->getRequest() instead.');
return $this->getOwner()->getRequest();
}

/**
* @return FormSchema
* @deprecated 2.4.0 Will be removed without equivalent functionality to replace it.
*/
protected function getFormSchema()
{
Deprecation::noticeWithNoReplacment('2.4.0');
return FormSchema::singleton();
}

Expand All @@ -69,7 +74,7 @@ public function remoteCreateForm()
*/
public function remoteEditForm()
{
$url = $this->getRequest()->requestVar('embedurl');
$url = $this->getOwner()->getRequest()->requestVar('embedurl');
$form = null;
$form = Injector::inst()->get(RemoteFileFormFactory::class)
->getForm(
Expand Down Expand Up @@ -116,10 +121,12 @@ public function remoteEditFormSchema(HTTPRequest $request)
* @param ValidationResult $errors Required for 'error' response
* @param array $extraData Any extra data to be merged with the schema response
* @return HTTPResponse
* @deprecated 2.4.0 Will be replaced with $this->getOwner()->getSchemaResponse() instead.
*/
protected function getSchemaResponse($schemaID, $form = null, ValidationResult $errors = null, $extraData = [])
{
$parts = $this->getRequest()->getHeader(LeftAndMain::SCHEMA_HEADER);
Deprecation::noticeWithNoReplacment('2.4.0', 'Will be replaced with $this->getOwner()->getSchemaResponse() instead.');
$parts = $this->getOwner()->getRequest()->getHeader(LeftAndMain::SCHEMA_HEADER);
$data = $this
->getFormSchema()
->getMultipartSchema($parts, $schemaID, $form, $errors);
Expand Down

0 comments on commit 44e88c0

Please sign in to comment.