Skip to content

Commit

Permalink
API Make UserDefinedFormAdmin a subclass of FormSchemaController (#1348)
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli authored Nov 19, 2024
1 parent c6f1341 commit 5cc8cbd
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions code/Control/UserDefinedFormAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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',
Expand All @@ -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
*/
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 5cc8cbd

Please sign in to comment.