-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1246 from creative-commoners/pulls/1/pjax-validat…
…ion-result ENH Pass form validation result to client
- Loading branch information
Showing
6 changed files
with
123 additions
and
3 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace SilverStripe\Admin\Tests\LeftAndMainTest; | ||
|
||
use SilverStripe\ORM\DataObject; | ||
use SilverStripe\Dev\TestOnly; | ||
|
||
class MyTree extends DataObject implements TestOnly | ||
{ | ||
public const INVALID_CONTENT = 'INVALID_CONTENT'; | ||
|
||
public const INVALID_CONTENT_MESSAGE = 'INVALID_CONTENT_MESSAGE'; | ||
|
||
private static $db = [ | ||
'Content' => 'Varchar' | ||
]; | ||
|
||
public function validate() | ||
{ | ||
$validationResult = parent::validate(); | ||
if ($this->Content === static::INVALID_CONTENT) { | ||
$validationResult->addFieldError('Content', static::INVALID_CONTENT_MESSAGE); | ||
} | ||
return $validationResult; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
namespace SilverStripe\Admin\Tests\LeftAndMainTest; | ||
|
||
use SilverStripe\Admin\LeftAndMain; | ||
use SilverStripe\Dev\TestOnly; | ||
|
||
class MyTreeController extends LeftAndMain implements TestOnly | ||
{ | ||
private static $url_segment = 'mytree/edit'; | ||
|
||
private static $tree_class = MyTree::class; | ||
|
||
private static $allowed_actions = [ | ||
'EditForm' | ||
]; | ||
|
||
private static $url_handlers = [ | ||
'EditForm/$ID' => 'EditForm', | ||
]; | ||
} |