Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Deprecate methods on RemoteFileModalExtension #1516

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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