Skip to content

Commit 5f908da

Browse files
Merge branch '5.4' into 5
2 parents 4d950df + a3a3ada commit 5f908da

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/Forms/GridField/GridFieldFilterHeader.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,9 +318,14 @@ public function setSearchContext(SearchContext $context): static
318318
*
319319
* @param GridField $gridfield
320320
* @return string
321+
* @deprecated 5.4.0 Will be replaced with SilverStripe\ORM\Search\SearchContextForm::getSchemaData()
321322
*/
322323
public function getSearchFieldSchema(GridField $gridField)
323324
{
325+
Deprecation::noticeWithNoReplacment(
326+
'5.4.0',
327+
'Will be replaced with SilverStripe\ORM\Search\SearchContextForm::getSchemaData()'
328+
);
324329
$schemaUrl = Controller::join_links($gridField->Link(), 'schema/SearchForm');
325330
$inst = singleton($gridField->getModelClass());
326331
$context = $this->getSearchContext($gridField);
@@ -424,17 +429,22 @@ public function getSearchForm(GridField $gridField)
424429
*
425430
* @param GridField $gridfield
426431
* @return HTTPResponse
432+
* @deprecated 5.4.0 Will be replaced with SilverStripe\Forms\FormRequestHandler::getSchema()
427433
*/
428434
public function getSearchFormSchema(GridField $gridField)
429435
{
436+
Deprecation::noticeWithNoReplacment(
437+
'5.4.0',
438+
'Will be replaced with SilverStripe\Forms\FormRequestHandler::getSchema()'
439+
);
430440
$form = $this->getSearchForm($gridField);
431441

432442
// If there are no filterable fields, return a 400 response
433443
if (!$form) {
434444
return new HTTPResponse(_t(__CLASS__ . '.SearchFormFaliure', 'No search form could be generated'), 400);
435445
}
436446

437-
$parts = $gridField->getRequest()->getHeader(LeftAndMain::SCHEMA_HEADER);
447+
$parts = $gridField->getRequest()->getHeader(FormSchema::SCHEMA_HEADER);
438448
$schemaID = $gridField->getRequest()->getURL();
439449
$data = FormSchema::singleton()
440450
->getMultipartSchema($parts, $schemaID, $form);

src/Forms/Schema/FormSchema.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ class FormSchema
4040
*/
4141
const PART_AUTO = 'auto';
4242

43+
/**
44+
* Form schema header identifier
45+
*/
46+
public const SCHEMA_HEADER = 'X-Formschema-Request';
47+
4348
/**
4449
* Returns a representation of the provided {@link Form} as structured data,
4550
* based on the request data.

0 commit comments

Comments
 (0)