class TestForm in Coder 8.3
Same name in this branch
Same name and namespace in other branches
- 8.2 coder_sniffer/DrupalPractice/Test/Objects/GlobalFunctionUnitTest.inc \TestForm
- 8.2 coder_sniffer/DrupalPractice/Test/Objects/GlobalDrupalUnitTest.inc \TestForm
- 8.2 coder_sniffer/DrupalPractice/Test/Objects/GlobalClassUnitTest.inc \TestForm
- 8.3.x tests/DrupalPractice/Objects/GlobalDrupalUnitTest.inc \TestForm
- 8.3.x tests/DrupalPractice/Objects/GlobalClassUnitTest.inc \TestForm
- 8.3.x tests/DrupalPractice/Objects/drupal8/TestForm.php \TestForm
Hierarchy
- class \TestForm extends \FormBase
Expanded class hierarchy of TestForm
File
- tests/
DrupalPractice/ Objects/ GlobalDrupalUnitTest.inc, line 3
View source
class TestForm extends FormBase {
public function buildForm($form, $form_state) {
$form['something'] = \Drupal::service('foobar')
->result();
// Accessing the Drupal version is fine and should not trigger a warning.
$version = \Drupal::VERSION;
}
public static function example() {
// \Drupal calls are allowed in static methods.
return \Drupal::service('foobar')
->result();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
TestForm:: |
public | function | ||
TestForm:: |
public static | function |