class ViewsTestDataErrorForm
Same name and namespace in other branches
- 9 core/modules/views/tests/modules/views_test_data/src/Form/ViewsTestDataErrorForm.php \Drupal\views_test_data\Form\ViewsTestDataErrorForm
- 8.9.x core/modules/views/tests/modules/views_test_data/src/Form/ViewsTestDataErrorForm.php \Drupal\views_test_data\Form\ViewsTestDataErrorForm
- 10 core/modules/views/tests/modules/views_test_data/src/Form/ViewsTestDataErrorForm.php \Drupal\views_test_data\Form\ViewsTestDataErrorForm
Implements a test form that has a validation error.
Hierarchy
- class \Drupal\views_test_data\Form\ViewsTestDataErrorForm extends \Drupal\Core\Form\FormInterface uses \Drupal\Core\StringTranslation\StringTranslationTrait
Expanded class hierarchy of ViewsTestDataErrorForm
File
-
core/
modules/ views/ tests/ modules/ views_test_data/ src/ Form/ ViewsTestDataErrorForm.php, line 14
Namespace
Drupal\views_test_data\FormView source
class ViewsTestDataErrorForm implements FormInterface {
use StringTranslationTrait;
/**
* {@inheritdoc}
*/
public function getFormId() {
return 'views_test_data_error_form';
}
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {
$form['text'] = [
'#type' => 'textfield',
];
$form['submit'] = [
'#type' => 'submit',
'#value' => $this->t('Submit'),
];
return $form;
}
/**
* {@inheritdoc}
*/
public function validateForm(array &$form, FormStateInterface $form_state) {
$form_state->setErrorByName('text', $this->t('Form validation error'));
}
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title | Overrides |
---|---|---|---|---|---|
StringTranslationTrait::$stringTranslation | protected | property | The string translation service. | 3 | |
StringTranslationTrait::formatPlural | protected | function | Formats a string containing a count of items. | ||
StringTranslationTrait::getNumberOfPlurals | protected | function | Returns the number of plurals supported by a given language. | ||
StringTranslationTrait::getStringTranslation | protected | function | Gets the string translation service. | ||
StringTranslationTrait::setStringTranslation | public | function | Sets the string translation service to use. | 2 | |
StringTranslationTrait::t | protected | function | Translates a string to the current language or to a given language. | 1 | |
ViewsTestDataErrorForm::buildForm | public | function | Form constructor. | Overrides FormInterface::buildForm | |
ViewsTestDataErrorForm::getFormId | public | function | Returns a unique string identifying the form. | Overrides FormInterface::getFormId | |
ViewsTestDataErrorForm::submitForm | public | function | Form submission handler. | Overrides FormInterface::submitForm | |
ViewsTestDataErrorForm::validateForm | public | function | Form validation handler. | Overrides FormInterface::validateForm |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.