Support applying #states to a horizontal tab

Created on 15 February 2022, almost 3 years ago
Updated 16 September 2024, 2 months ago

Problem/Motivation

Currently, applying states to change visibility of a horizontal tab, does not work.

Steps to reproduce

In a custom module create something like described in the api documentation:

/**
 * Implements hook_field_group_form_process_build_alter().
 */
function mymodule_field_group_form_process_build_alter(array &$element, FormStateInterface $form_state, &$complete_form) {
  $element['group_my_group']['#states'] = [
    'visible' => [
      ':input[name="field_toggle[value]"]' => ['checked' => TRUE],
    ],
  ];
}

And create a node form with at least two horizontal tabs. The second one being named "group_my_group" and the first one containing the boolean "field_toggle" checkbox.

Create a node and toggle the checkbox. The tab does not appear/dissapear but instead the fields are added below in the first tab.

Proposed resolution

Support #states similar to vertical tabs in 🐛 Applying #states to a vertical tab does not update the vertical tabs menu Needs work .

Remaining tasks

Write patch. Review. Test.

User interface changes

None.

API changes

None.

Data model changes

None.

Feature request
Status

Needs review

Version

4.0

Component

Miscellaneous

Created by

🇳🇱Netherlands askibinski

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024