I have a textfield element (named ‘bus_station’), which holds a bus station name. Is there a way to create a custom ‘bus_station’ element (extending Textfield class), which would:
- Still expect a text input in form of bus station name (and retain it during
$form_state->setRebuild()
), but - In
$form_value
, after form submit, either provide aFALSE
(some custom code in Element definition doesn’t recognize input as a station) orTRUE
(it does recognize a station)?
In a nutshell – different value in '#value'
of Textfield array and different value in $form_state
values after submit?
Thank you very much!