Skip to content

Commit

Permalink
Default to schema response part in LeftAndMain->schema()
Browse files Browse the repository at this point in the history
More of a standard API approach to return data by default, and make customisation
via HTTP headers an optional mode.
  • Loading branch information
chillu authored and Damian Mooyman committed Mar 28, 2016
1 parent b1faa88 commit 366c636
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions admin/code/LeftAndMain.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,13 +231,8 @@ protected function getSchemaForForm(Form $form) {
$validHeaderValues = ['schema', 'state'];
return in_array(trim($value), $validHeaderValues);
});
}

if (!count($schemaParts)) {
throw new SS_HTTPResponse_Exception(
'Invalid request. Check you\'ve set a "X-Formschema-Request" header with "schema" or "state" values.',
400
);
} else {
$schemaParts = ['schema'];
}

$return = ['id' => $form->getName()];
Expand Down

0 comments on commit 366c636

Please sign in to comment.