From 5cc8cbd187c3e572a10810025c9298b8b79b3562 Mon Sep 17 00:00:00 2001 From: Guy Sartorelli <36352093+GuySartorelli@users.noreply.github.com> Date: Tue, 19 Nov 2024 17:44:46 +1300 Subject: [PATCH] API Make UserDefinedFormAdmin a subclass of FormSchemaController (#1348) --- code/Control/UserDefinedFormAdmin.php | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/code/Control/UserDefinedFormAdmin.php b/code/Control/UserDefinedFormAdmin.php index d81be80a..69241d3f 100644 --- a/code/Control/UserDefinedFormAdmin.php +++ b/code/Control/UserDefinedFormAdmin.php @@ -2,8 +2,7 @@ namespace SilverStripe\UserForms\Control; -use SilverStripe\Admin\AdminRootController; -use SilverStripe\Admin\LeftAndMain; +use SilverStripe\Admin\FormSchemaController; use SilverStripe\Assets\Folder; use SilverStripe\Control\HTTPRequest; use SilverStripe\Control\HTTPResponse; @@ -31,10 +30,8 @@ /** * Provides a few endpoints the user form CMS UI targets with some AJAX request. - * - * @note While this is a LeftAndMain controller, it doesn't actually appear in the Left side CMS navigation. */ -class UserDefinedFormAdmin extends LeftAndMain +class UserDefinedFormAdmin extends FormSchemaController { private static $allowed_actions = [ 'confirmfolderformschema', @@ -47,8 +44,6 @@ class UserDefinedFormAdmin extends LeftAndMain private static $url_segment = 'user-forms'; - private static $ignore_menuitem = true; - /** * @var string The name of the folder where form submissions will be placed by default */ @@ -80,7 +75,6 @@ private static function getRestrictedAccessField(string $folder, string $title) return $textField; } - public function index(HTTPRequest $request): HTTPResponse { // Don't serve anythign under the main URL. @@ -141,7 +135,7 @@ public function confirmfolderformschema(HTTPRequest $request) } // create the schema response - $parts = $this->getRequest()->getHeader(static::SCHEMA_HEADER); + $parts = $this->getRequest()->getHeader(FormSchemaController::SCHEMA_HEADER); $schemaID = $this->getRequest()->getURL(); $data = FormSchema::singleton()->getMultipartSchema($parts, $schemaID, $form);