From 388a29dfb935ac6454be105f0defd5cb7287ac38 Mon Sep 17 00:00:00 2001 From: Guy Sartorelli Date: Wed, 26 Feb 2025 11:48:48 +1300 Subject: [PATCH] API Deprecate API being removed in CMS 6 --- src/Forms/GridField/GridFieldFilterHeader.php | 12 +++++++++++- src/Forms/Schema/FormSchema.php | 5 +++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/Forms/GridField/GridFieldFilterHeader.php b/src/Forms/GridField/GridFieldFilterHeader.php index faab12cfd00..525b1dbeaf7 100755 --- a/src/Forms/GridField/GridFieldFilterHeader.php +++ b/src/Forms/GridField/GridFieldFilterHeader.php @@ -318,9 +318,14 @@ public function setSearchContext(SearchContext $context): static * * @param GridField $gridfield * @return string + * @deprecated 5.4.0 Will be replaced with SilverStripe\ORM\Search\SearchContextForm::getSchemaData() */ public function getSearchFieldSchema(GridField $gridField) { + Deprecation::noticeWithNoReplacment( + '5.4.0', + 'Will be replaced with SilverStripe\ORM\Search\SearchContextForm::getSchemaData()' + ); $schemaUrl = Controller::join_links($gridField->Link(), 'schema/SearchForm'); $inst = singleton($gridField->getModelClass()); $context = $this->getSearchContext($gridField); @@ -424,9 +429,14 @@ public function getSearchForm(GridField $gridField) * * @param GridField $gridfield * @return HTTPResponse + * @deprecated 5.4.0 Will be replaced with SilverStripe\Forms\FormRequestHandler::getSchema() */ public function getSearchFormSchema(GridField $gridField) { + Deprecation::noticeWithNoReplacment( + '5.4.0', + 'Will be replaced with SilverStripe\Forms\FormRequestHandler::getSchema()' + ); $form = $this->getSearchForm($gridField); // If there are no filterable fields, return a 400 response @@ -434,7 +444,7 @@ public function getSearchFormSchema(GridField $gridField) return new HTTPResponse(_t(__CLASS__ . '.SearchFormFaliure', 'No search form could be generated'), 400); } - $parts = $gridField->getRequest()->getHeader(LeftAndMain::SCHEMA_HEADER); + $parts = $gridField->getRequest()->getHeader(FormSchema::SCHEMA_HEADER); $schemaID = $gridField->getRequest()->getURL(); $data = FormSchema::singleton() ->getMultipartSchema($parts, $schemaID, $form); diff --git a/src/Forms/Schema/FormSchema.php b/src/Forms/Schema/FormSchema.php index a8b712a14e7..57957c9f015 100644 --- a/src/Forms/Schema/FormSchema.php +++ b/src/Forms/Schema/FormSchema.php @@ -40,6 +40,11 @@ class FormSchema */ const PART_AUTO = 'auto'; + /** + * Form schema header identifier + */ + public const SCHEMA_HEADER = 'X-Formschema-Request'; + /** * Returns a representation of the provided {@link Form} as structured data, * based on the request data.