2016-10-14 03:30:05 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace SilverStripe\Control\Tests\RequestHandlingTest;
|
|
|
|
|
|
|
|
use SilverStripe\Dev\TestOnly;
|
|
|
|
use SilverStripe\Forms\FormField;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Form field for the test
|
|
|
|
*/
|
|
|
|
class TestFormField extends FormField implements TestOnly
|
|
|
|
{
|
2020-04-20 19:58:09 +02:00
|
|
|
private static $url_handlers = [
|
2016-12-16 05:34:21 +01:00
|
|
|
"POST " => "handleInPlaceEdit",
|
|
|
|
'' => 'handleField',
|
|
|
|
'$Action' => '$Action',
|
2020-04-20 19:58:09 +02:00
|
|
|
];
|
2016-10-14 03:30:05 +02:00
|
|
|
|
2016-12-16 05:34:21 +01:00
|
|
|
// These contain uppercase letters to test that allowed_actions doesn't need to be all lowercase
|
2020-04-20 19:58:09 +02:00
|
|
|
private static $allowed_actions = [
|
2016-12-16 05:34:21 +01:00
|
|
|
'TEST',
|
|
|
|
'handleField',
|
|
|
|
'handleInPLACEEDIT',
|
2020-04-20 19:58:09 +02:00
|
|
|
];
|
2016-10-14 03:30:05 +02:00
|
|
|
|
2016-12-16 05:34:21 +01:00
|
|
|
public function test()
|
|
|
|
{
|
|
|
|
return "Test method on $this->name";
|
|
|
|
}
|
2016-10-14 03:30:05 +02:00
|
|
|
|
2016-12-16 05:34:21 +01:00
|
|
|
public function handleField()
|
|
|
|
{
|
|
|
|
return "$this->name requested";
|
|
|
|
}
|
2016-10-14 03:30:05 +02:00
|
|
|
|
2016-12-16 05:34:21 +01:00
|
|
|
public function handleInPlaceEdit($request)
|
|
|
|
{
|
|
|
|
return "$this->name posted, update to " . $request->postVar($this->name);
|
|
|
|
}
|
2016-10-14 03:30:05 +02:00
|
|
|
}
|