I'm using Drupal 8.4 with Field Group 3.x-dev.
The Field Group documentation (https://www.drupal.org/node/1017962) states that hook_field_group_build_pre_render_alter() can be used to set the states of field groups via the States API.
The documentation continues:
// While custom fields and groups are present at the root level of the form
// e.g. $element['field_custom_field'] they will later be moved into
// $element['additional_settings']['group']['#groups']['additional_settings']['field_custom_field']
// which is where we need to alter them.
However, although this hook is available in the D8 version, when I do kint($element) there is no additional_settings to change. Where has this moved to in Drupal 8?
Comments
Comment #2
alduya commentedThere is an example in this comment: https://www.drupal.org/project/field_group/issues/1053174#comment-12234371
Comment #3
pianomansam commented@alduya's answer in #2 shows how to do this.