mirror of
https://github.com/a2nt/silverstripe-elemental-basics.git
synced 2024-10-22 17:05:54 +02:00
Compare commits
No commits in common. "370b2c07649a12225a0af69f1e0018a3bf57534e" and "817b20f5c3d80eb88ef3041c1ed3168729619e78" have entirely different histories.
370b2c0764
...
817b20f5c3
@ -17,10 +17,6 @@ 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:
|
||||||
|
@ -1,61 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace A2nt\ElementalBasics\Controllers;
|
|
||||||
|
|
||||||
use DNADesign\ElementalUserForms\Control\ElementFormController as ControlElementFormController;
|
|
||||||
use SilverStripe\Control\Controller;
|
|
||||||
use SilverStripe\Control\Director;
|
|
||||||
use SilverStripe\ORM\ValidationResult;
|
|
||||||
|
|
||||||
class ElementFormController extends ControlElementFormController
|
|
||||||
{
|
|
||||||
private static $allowed_actions = [
|
|
||||||
'Form',
|
|
||||||
'finished',
|
|
||||||
];
|
|
||||||
|
|
||||||
public function Form()
|
|
||||||
{
|
|
||||||
$form = parent::Form();
|
|
||||||
|
|
||||||
// Elements actions
|
|
||||||
$current = Controller::curr();
|
|
||||||
$link = $current->Link();
|
|
||||||
|
|
||||||
if (is_a($current, self::class)) {
|
|
||||||
$link = $current->getElement()->getPage()->Link();
|
|
||||||
}
|
|
||||||
|
|
||||||
$link = Director::makeRelative($link);
|
|
||||||
$link = !$link || $link === '/' ? '/home' : $link;
|
|
||||||
|
|
||||||
$form->setFormAction(
|
|
||||||
Controller::join_links(
|
|
||||||
'/',
|
|
||||||
$link,
|
|
||||||
'element',
|
|
||||||
$this->owner->ID,
|
|
||||||
__FUNCTION__
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return $form;
|
|
||||||
}
|
|
||||||
|
|
||||||
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,5 +1,6 @@
|
|||||||
<?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