Over in #1742438: Vertical tabs header and container rendered even when no vertical tabs we added logic to ensure the user can see at least one tab before rendering the vertical tab wrapper, hidden field and h2 title.
In comment 16, @webchick noted that it would be useful this logic in a helper function.
This task is a follow-up to ensure that idea doesn't get lost.
The code was like so:
+++ b/core/includes/form.inc
@@ -3796,11 +3796,26 @@ function form_process_vertical_tabs($element, &$form_state) {
+ foreach (element_children($element['group']) as $tab_index) {
+ if (!isset($element['group'][$tab_index]['#access']) ||
+ !empty($element['group'][$tab_index]['#access'])) {
+ $visible_tab = TRUE;
+ break;
+ }
+ }
Comments
Comment #1
mgiffordThanks! Any ideas on what this function should be named?
Comment #2
larowlanhmm
vertical_tabs_tab_access ?
best I've got for this early in the morning!
Comment #3
fenda commentedI'll give this a go with the proposed function name vertical_tabs_tab_access.
Comment #4
fenda commentedHere's a quick patch. Some questions:
Comment #6
fenda commentedOops, left out an important line.
Comment #8
fenda commented#6: vertical-tabs-access-helper-1800434-6.patch queued for re-testing.
Comment #9
mgifford6: vertical-tabs-access-helper-1800434-6.patch queued for re-testing.
Comment #11
biro.botond commentedComment #12
pasive commentedWell guys I don't think this issue still applies to Drupal 8 as there is no more "theme_vertical_tabs" function in the core.
The issue though might still be applicable to Drupal 7 so I am changing it to relevant version.
I'd like others input testing this is the issue still applies and can be reproduced!
Comment #13
pasive commented6: vertical-tabs-access-helper-1800434-6.patch queued for re-testing.
Comment #15
pasive commentedUploading new patch to match current code base.
Comment #16
pasive commentedCorrect name-spacing for the patch
Comment #17
gaurav.goyal commentedChanging Status of this issue to need review, so that this patch can be reviewed.
Comment #18
mgiffordGreat to see that @pasive patch still applies.
It's already in D8, what manual testing is required? Seems to work fine.