- Issue created by @psf_
- First commit to issue fork.
How an undocumented functionality I found that we can use #states in radio buttons and this module.
We can define a radio this way:
$form['radiosfield'] = Array
(
[#type] => radios
[#title] => Title
[#title_display] => before
[#id] => payment_method
[#options] => Array
(
[1] => opc 2
[2] => Demo
[3] => opc 3
[4] => opc 4
)
[#options_attributes] => Array
(
[1] => Array
(
[data-drupal-states] => {"visible":{":input[name=\u0022installments\u0022]":{"value":1}}}
)
[2] => Array
(
[data-drupal-states] => {"visible":{":input[name=\u0022installments\u0022]":{"value":1}}}
)
[3] => Array
(
[data-drupal-states] => {"visible":{":input[name=\u0022installments\u0022]":{"value":1}}}
)
[4] => Array
(
[data-drupal-states] => {"visible":{":input[name=\u0022installments\u0022]":{"value":1}}}
)
)
)
The json in 'data-drupal-states'
it's the #states
array in json format.
Active
2.0
Code