DIsplay/hide field group with states fromapi

Public

DIsplay/hide field group with states

Get raw version
php
  1. function my_module_field_group_build_pre_render_alter(&$element) {
  2. if (isset($element['group_name'])) {
  3. $element['group_name'] += array(
  4. '#states' => array(
  5. 'visible' => array(
  6. ':input[name="field_name"]' => array('value' => 'value'),
  7. ),
  8. ),
  9. '#id' => 'group_name',
  10. );
  11. }
  12. }