Source of file TestElementController.php
Size: 0,982 Bytes - Last Modified: 2021-12-24T06:44:48+00:00
/var/www/docs.ssmods.com/process/src/tests/Src/TestElementController.php
123456789101112131415161718192021222324252627282930313233343536373839404142434445 | <?php namespace DNADesign\Elemental\Tests\Src; use DNADesign\Elemental\Controllers\ElementController; use SilverStripe\Dev\TestOnly; use SilverStripe\Forms\FieldList; use SilverStripe\Forms\Form; use SilverStripe\Forms\FormAction; use SilverStripe\Forms\TextField; class TestElementController extends ElementController implements TestOnly { private static $url_segment = 'test-page'; private static $allowed_actions = array( 'Form' ); public function Form() { $elementform = new Form( $this, 'Form', new FieldList( new TextField('TestValue') ), new FieldList( new FormAction('doAction') ) ); return $elementform; } public function doAction($data, $form) { return sprintf( 'TestValue: %s\nElement ID: %d', $data['TestValue'], $this->element->ID ); } } |