From 44e88c0927370f4b823987e69a39d20443ba68ac Mon Sep 17 00:00:00 2001 From: Guy Sartorelli Date: Tue, 26 Nov 2024 10:57:01 +1300 Subject: [PATCH] API Deprecate methods on RemoteFileModalExtension --- code/Extensions/RemoteFileModalExtension.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/code/Extensions/RemoteFileModalExtension.php b/code/Extensions/RemoteFileModalExtension.php index a6d6deced..8a1227fc7 100644 --- a/code/Extensions/RemoteFileModalExtension.php +++ b/code/Extensions/RemoteFileModalExtension.php @@ -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; @@ -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(); } @@ -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( @@ -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);