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 Make UserDefinedFormAdmin a subclass of FormSchemaController #1348

Open
wants to merge 1 commit into
base: 7
Choose a base branch
from
Open
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: 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
Loading