mirror of
https://github.com/a2nt/silverstripe-elemental-basics.git
synced 2024-10-22 17:05:54 +02:00
IMPR: AJAX finish response for ElementForm
This commit is contained in:
parent
817b20f5c3
commit
af29804172
@ -17,6 +17,10 @@ SilverStripe\UserForms\Model\UserDefinedForm:
|
|||||||
can_be_root: false
|
can_be_root: false
|
||||||
extensions:
|
extensions:
|
||||||
- A2nt\ElementalBasics\Extensions\UserDefinedFormExtension
|
- A2nt\ElementalBasics\Extensions\UserDefinedFormExtension
|
||||||
|
|
||||||
|
SilverStripe\Core\Injector\Injector:
|
||||||
|
DNADesign\ElementalUserForms\Control\ElementFormController:
|
||||||
|
class: A2nt\ElementalBasics\Controllers\ElementFormController
|
||||||
##################
|
##################
|
||||||
|
|
||||||
SilverStripe\CMS\Controllers\ContentController:
|
SilverStripe\CMS\Controllers\ContentController:
|
||||||
|
33
src/Controllers/ElementFormController.php
Normal file
33
src/Controllers/ElementFormController.php
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace A2nt\ElementalBasics\Controllers;
|
||||||
|
|
||||||
|
use DNADesign\Elemental\Models\BaseElement;
|
||||||
|
use DNADesign\ElementalUserForms\Control\ElementFormController as ControlElementFormController;
|
||||||
|
use SilverStripe\Control\Director;
|
||||||
|
use SilverStripe\Core\Injector\Injector;
|
||||||
|
use SilverStripe\ORM\ValidationResult;
|
||||||
|
|
||||||
|
class ElementFormController extends ControlElementFormController
|
||||||
|
{
|
||||||
|
private static $allowed_actions = [
|
||||||
|
'finished',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function finished()
|
||||||
|
{
|
||||||
|
$user = $this->getUserFormController();
|
||||||
|
$user->finished();
|
||||||
|
|
||||||
|
$page = $this->getPage();
|
||||||
|
if (Director::is_ajax()) {
|
||||||
|
$el = $this->getElement();
|
||||||
|
return json_encode([
|
||||||
|
'message' => $el->OnCompleteMessage,
|
||||||
|
'status' => ValidationResult::TYPE_GOOD,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent::finished();
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
||||||
namespace A2nt\ElementalBasics\Controllers;
|
namespace A2nt\ElementalBasics\Controllers;
|
||||||
|
|
||||||
use DNADesign\Elemental\Controllers\ElementController;
|
use DNADesign\Elemental\Controllers\ElementController;
|
||||||
|
Loading…
Reference in New Issue
Block a user