Source of file TestWidgetController.php
Size: 0,995 Bytes - Last Modified: 2021-12-23T10:36:20+00:00
/var/www/docs.ssmods.com/process/src/tests/WidgetControllerTest/TestWidgetController.php
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 | <?php namespace SilverStripe\Widgets\Tests\WidgetControllerTest; use SilverStripe\Dev\TestOnly; use SilverStripe\Forms\FieldList; use SilverStripe\Forms\Form; use SilverStripe\Forms\FormAction; use SilverStripe\Forms\TextField; use SilverStripe\Widgets\Model\WidgetController; /** * @package widgets * @subpackage tests */ class TestWidgetController extends WidgetController implements TestOnly { private static $allowed_actions = array( 'Form' ); public function Form() { $widgetform = new Form( $this, __FUNCTION__, new FieldList( new TextField('TestValue') ), new FieldList( new FormAction('doAction') ) ); return $widgetform; } public function doAction($data, $form) { return sprintf( 'TestValue: %s\nWidget ID: %d', $data['TestValue'], $this->widget->ID ); } } |