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

ptmkenny created an issue. See original summary.

alduya’s picture

pianomansam’s picture

Status: Active » Closed (duplicate)
Related issues: +#1053174: hook_form_alter form state problems

@alduya's answer in #2 shows how to do this.