class DurationElementStatesTestForm in Duration Field 3.0.x
Same name and namespace in other branches
- 8.2 tests/modules/duration_field_form_test/src/Form/DurationElementStatesTestForm.php \Drupal\duration_field_form_test\Form\DurationElementStatesTestForm
Form for testing JavaScript #states behavior on 'duration' elements.
Hierarchy
- class \Drupal\duration_field_form_test\Form\DurationElementStatesTestForm implements FormInterface
Expanded class hierarchy of DurationElementStatesTestForm
1 string reference to 'DurationElementStatesTestForm'
- duration_field_form_test.routing.yml in tests/
modules/ duration_field_form_test/ duration_field_form_test.routing.yml - tests/modules/duration_field_form_test/duration_field_form_test.routing.yml
File
- tests/
modules/ duration_field_form_test/ src/ Form/ DurationElementStatesTestForm.php, line 11
Namespace
Drupal\duration_field_form_test\FormView source
class DurationElementStatesTestForm implements FormInterface {
/**
* {@inheritdoc}
*/
public function getFormId() {
return 'duration_form_element_states_test';
}
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {
// Trigger element.
$form['checkbox_trigger'] = [
'#type' => 'checkbox',
'#title' => 'Checkbox trigger',
];
// Duration elements that respond to the trigger.
$form['duration_invisible_when_checkbox_trigger_checked'] = [
'#type' => 'duration',
'#title' => 'Duration invisible when checkbox trigger checked',
'#states' => [
'invisible' => [
':input[name="checkbox_trigger"]' => [
'checked' => TRUE,
],
],
],
];
$form['submit'] = [
'#type' => 'submit',
'#value' => t('Submit'),
];
return $form;
}
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
}
/**
* {@inheritdoc}
*/
public function validateForm(array &$form, FormStateInterface $form_state) {
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DurationElementStatesTestForm:: |
public | function |
Form constructor. Overrides FormInterface:: |
|
DurationElementStatesTestForm:: |
public | function |
Returns a unique string identifying the form. Overrides FormInterface:: |
|
DurationElementStatesTestForm:: |
public | function |
Form submission handler. Overrides FormInterface:: |
|
DurationElementStatesTestForm:: |
public | function |
Form validation handler. Overrides FormInterface:: |