diff --git a/_config.php b/_config.php index e69de29..f716afd 100644 --- a/_config.php +++ b/_config.php @@ -0,0 +1,3 @@ +EnableRESTAPI) + return $this->permissionFailure(); + if(!isset($this->urlParams['ClassName'])) return $this->notFound(); $className = $this->urlParams['ClassName']; $id = (isset($this->urlParams['ID'])) ? $this->urlParams['ID'] : null; diff --git a/code/RestfulSiteConfig.php b/code/RestfulSiteConfig.php new file mode 100644 index 0000000..eeca039 --- /dev/null +++ b/code/RestfulSiteConfig.php @@ -0,0 +1,21 @@ + array( + 'EnableRESTAPI' => 'Boolean' + ), + 'defaults' => array( + 'EnableRESTAPI' => false + ) + ); + } + + function updateCMSFields(FieldList $fields) { + $fields->addFieldToTab('Root.Main', new CheckboxField('EnableRESTAPI', 'Enable the REST API')); + } +}