@@ -664,20 +664,22 @@ function template_preprocess_views_view_table(&$variables) {
664
664
// variables, although core templates now all use 'summary_element' instead.
665
665
$ variables ['summary ' ] = $ handler ->options ['summary ' ];
666
666
$ variables ['description ' ] = $ handler ->options ['description ' ];
667
- $ variables ['summary_element ' ] = [
668
- '#type ' => 'details ' ,
669
- '#title ' => $ handler ->options ['summary ' ],
670
- // To ensure that the description is properly escaped during rendering, use
671
- // an 'inline_template' to let Twig do its magic, instead of 'markup'.
672
- 'description ' => [
673
- '#type ' => 'inline_template ' ,
674
- '#template ' => '{{ description }} ' ,
675
- '#context ' => [
676
- 'description ' => $ handler ->options ['description ' ],
667
+ if (!empty ($ handler ->options ['summary ' ]) || !empty ($ handler ->options ['description ' ])) {
668
+ $ variables ['summary_element ' ] = [
669
+ '#type ' => 'details ' ,
670
+ '#title ' => $ handler ->options ['summary ' ],
671
+ // To ensure that the description is properly escaped during rendering,
672
+ // use an 'inline_template' to let Twig do its magic, instead of 'markup'.
673
+ 'description ' => [
674
+ '#type ' => 'inline_template ' ,
675
+ '#template ' => '{{ description }} ' ,
676
+ '#context ' => [
677
+ 'description ' => $ handler ->options ['description ' ],
678
+ ],
677
679
],
678
- ],
679
- ] ;
680
- $ variables [ ' caption_needed ' ] |= ! empty ( $ variables [ ' summary ' ]) || ! empty ( $ variables [ ' description ' ]);
680
+ ];
681
+ $ variables [ ' caption_needed ' ] = TRUE ;
682
+ }
681
683
682
684
$ variables ['responsive ' ] = FALSE ;
683
685
// If the table has headers and it should react responsively to columns hidden
0 commit comments