silverstripe /
silverstripe-widgets
| 1 | <?php |
||||
| 2 | |||||
| 3 | namespace SilverStripe\Widgets\Tests\WidgetControllerTest; |
||||
| 4 | |||||
| 5 | use SilverStripe\Dev\TestOnly; |
||||
| 6 | use SilverStripe\Forms\FieldList; |
||||
| 7 | use SilverStripe\Forms\Form; |
||||
| 8 | use SilverStripe\Forms\FormAction; |
||||
| 9 | use SilverStripe\Forms\TextField; |
||||
| 10 | use SilverStripe\Widgets\Model\WidgetController; |
||||
| 11 | |||||
| 12 | /** |
||||
| 13 | * @package widgets |
||||
| 14 | * @subpackage tests |
||||
| 15 | */ |
||||
| 16 | class TestWidgetController extends WidgetController implements TestOnly |
||||
| 17 | { |
||||
| 18 | private static $allowed_actions = array( |
||||
|
0 ignored issues
–
show
introduced
by
Loading history...
|
|||||
| 19 | 'Form' |
||||
| 20 | ); |
||||
| 21 | |||||
| 22 | public function Form() |
||||
| 23 | { |
||||
| 24 | $widgetform = new Form( |
||||
| 25 | $this, |
||||
| 26 | __FUNCTION__, |
||||
| 27 | new FieldList( |
||||
| 28 | new TextField('TestValue') |
||||
| 29 | ), |
||||
| 30 | new FieldList( |
||||
| 31 | new FormAction('doAction') |
||||
| 32 | ) |
||||
| 33 | ); |
||||
| 34 | |||||
| 35 | return $widgetform; |
||||
| 36 | } |
||||
| 37 | |||||
| 38 | public function doAction($data, $form) |
||||
|
0 ignored issues
–
show
The parameter
$form is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. Loading history...
|
|||||
| 39 | { |
||||
| 40 | return sprintf( |
||||
| 41 | 'TestValue: %s\nWidget ID: %d', |
||||
| 42 | $data['TestValue'], |
||||
| 43 | $this->widget->ID |
||||
| 44 | ); |
||||
| 45 | } |
||||
| 46 | } |
||||
| 47 |