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 API being removed in CMS 6 #11623

Merged
Merged
Show file tree
Hide file tree
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
12 changes: 11 additions & 1 deletion src/Forms/GridField/GridFieldFilterHeader.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -424,17 +429,22 @@ 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
if (!$form) {
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);
Expand Down
5 changes: 5 additions & 0 deletions src/Forms/Schema/FormSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down