From 0731c50de3f2f024d4d87dc78f0ef91c9d92bc2e Mon Sep 17 00:00:00 2001 From: Volker Killesreiter Date: Fri, 27 Oct 2023 14:30:40 +0200 Subject: [PATCH 1/8] target field_paragraphs directly --- modules/thunder_paragraphs/css/paragraphs.widget.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/thunder_paragraphs/css/paragraphs.widget.css b/modules/thunder_paragraphs/css/paragraphs.widget.css index 5baff02e4..135747e1e 100644 --- a/modules/thunder_paragraphs/css/paragraphs.widget.css +++ b/modules/thunder_paragraphs/css/paragraphs.widget.css @@ -1,7 +1,7 @@ /* Subform */ /* Remove paragraphs table header. */ -.field--name-field-paragraphs .paragraphs-tabs-wrapper table.field-multiple-table:first-of-type thead { +.field--name-field-paragraphs .paragraphs-tabs-wrapper [data-drupal-selector="edit-field-paragraphs"] > table.field-multiple-table > thead { display: none; } .paragraph-type--link .paragraphs-subform .field--name-field-link table.field-multiple-table:first-of-type thead { From cfd784a4a66a6296a7c29f10c39ce26dc7bfdd0a Mon Sep 17 00:00:00 2001 From: Volker Killesreiter Date: Mon, 30 Oct 2023 16:04:52 +0100 Subject: [PATCH 2/8] try different selector --- modules/thunder_paragraphs/css/paragraphs.widget.css | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/thunder_paragraphs/css/paragraphs.widget.css b/modules/thunder_paragraphs/css/paragraphs.widget.css index 135747e1e..70891228e 100644 --- a/modules/thunder_paragraphs/css/paragraphs.widget.css +++ b/modules/thunder_paragraphs/css/paragraphs.widget.css @@ -1,7 +1,10 @@ /* Subform */ /* Remove paragraphs table header. */ -.field--name-field-paragraphs .paragraphs-tabs-wrapper [data-drupal-selector="edit-field-paragraphs"] > table.field-multiple-table > thead { +/*.field--name-field-paragraphs .paragraphs-tabs-wrapper [data-drupal-selector="edit-field-paragraphs"] > table.field-multiple-table > thead {*/ +/* display: none;*/ +/*}*/ +.field--widget-paragraphs .paragraphs-tabs-wrapper > .form-item--multiple > table.field-multiple-table > thead { display: none; } .paragraph-type--link .paragraphs-subform .field--name-field-link table.field-multiple-table:first-of-type thead { From f01b5370927f29356962625b98a657d1b6ccd234 Mon Sep 17 00:00:00 2001 From: Volker Killesreiter Date: Tue, 30 Apr 2024 12:32:14 +0200 Subject: [PATCH 3/8] switch to widget class --- modules/thunder_paragraphs/css/paragraphs.widget.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/thunder_paragraphs/css/paragraphs.widget.css b/modules/thunder_paragraphs/css/paragraphs.widget.css index 4646388bc..3f63394df 100644 --- a/modules/thunder_paragraphs/css/paragraphs.widget.css +++ b/modules/thunder_paragraphs/css/paragraphs.widget.css @@ -1,10 +1,10 @@ /* Subform */ /* Hide paragraphs field label in table header. */ -.field--name-field-paragraphs .paragraphs-tabs-wrapper table.field-multiple-table:first-of-type th { +.field--widget-paragraphs .paragraphs-tabs-wrapper table.field-multiple-table:first-of-type th { background: var(--gin-bg-layer); } -.field--name-field-paragraphs .paragraphs-tabs-wrapper table.field-multiple-table:first-of-type thead th.field-label h4 { +.field--widget-paragraphs .paragraphs-tabs-wrapper table.field-multiple-table:first-of-type thead th.field-label h4 { display: none; } .paragraph-type--link .paragraphs-subform .field--name-field-link table.field-multiple-table:first-of-type thead { From 166449e2e870b0e3f58390f38c6d9b96ea7e48af Mon Sep 17 00:00:00 2001 From: shagel Date: Fri, 3 May 2024 10:18:04 +0200 Subject: [PATCH 4/8] Only hide the first h4 of the first table, display the h4 labels of the subtables --- modules/thunder_paragraphs/css/paragraphs.widget.css | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/thunder_paragraphs/css/paragraphs.widget.css b/modules/thunder_paragraphs/css/paragraphs.widget.css index 3f63394df..2159113f3 100644 --- a/modules/thunder_paragraphs/css/paragraphs.widget.css +++ b/modules/thunder_paragraphs/css/paragraphs.widget.css @@ -7,6 +7,9 @@ .field--widget-paragraphs .paragraphs-tabs-wrapper table.field-multiple-table:first-of-type thead th.field-label h4 { display: none; } +.field--widget-paragraphs .paragraphs-tabs-wrapper table.field-multiple-table:first-of-type table thead th.field-label h4 { + display: block; +} .paragraph-type--link .paragraphs-subform .field--name-field-link table.field-multiple-table:first-of-type thead { display: none; } From 215b0f0c4038facaa48a7499ed42d2b8d5bca558 Mon Sep 17 00:00:00 2001 From: shagel Date: Fri, 3 May 2024 10:37:28 +0200 Subject: [PATCH 5/8] Only hide the first h4 of the first table, display the h4 labels of the subtables --- modules/thunder_paragraphs/css/paragraphs.widget.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/thunder_paragraphs/css/paragraphs.widget.css b/modules/thunder_paragraphs/css/paragraphs.widget.css index 2159113f3..e67936f18 100644 --- a/modules/thunder_paragraphs/css/paragraphs.widget.css +++ b/modules/thunder_paragraphs/css/paragraphs.widget.css @@ -4,10 +4,10 @@ .field--widget-paragraphs .paragraphs-tabs-wrapper table.field-multiple-table:first-of-type th { background: var(--gin-bg-layer); } -.field--widget-paragraphs .paragraphs-tabs-wrapper table.field-multiple-table:first-of-type thead th.field-label h4 { +.field--widget-paragraphs .paragraphs-tabs-wrapper table.field-multiple-table thead th.field-label h4 { display: none; } -.field--widget-paragraphs .paragraphs-tabs-wrapper table.field-multiple-table:first-of-type table thead th.field-label h4 { +.field--widget-paragraphs .paragraphs-tabs-wrapper table.field-multiple-table table thead th.field-label h4 { display: block; } .paragraph-type--link .paragraphs-subform .field--name-field-link table.field-multiple-table:first-of-type thead { From d04ce6b010afda6fca6f6ab5c0f3d274c559fe2b Mon Sep 17 00:00:00 2001 From: Volker Killesreiter Date: Tue, 7 May 2024 13:59:28 +0200 Subject: [PATCH 6/8] add class to directly address label in table header --- .../css/paragraphs.widget.css | 11 ++++----- .../thunder_paragraphs.module | 23 +++++++------------ 2 files changed, 12 insertions(+), 22 deletions(-) diff --git a/modules/thunder_paragraphs/css/paragraphs.widget.css b/modules/thunder_paragraphs/css/paragraphs.widget.css index e67936f18..6a4170f25 100644 --- a/modules/thunder_paragraphs/css/paragraphs.widget.css +++ b/modules/thunder_paragraphs/css/paragraphs.widget.css @@ -1,15 +1,12 @@ -/* Subform */ - -/* Hide paragraphs field label in table header. */ +/* Set background in table header. */ .field--widget-paragraphs .paragraphs-tabs-wrapper table.field-multiple-table:first-of-type th { background: var(--gin-bg-layer); } -.field--widget-paragraphs .paragraphs-tabs-wrapper table.field-multiple-table thead th.field-label h4 { +/* Hide paragraphs field label in table header. */ +.field--widget-paragraphs table.field-multiple-table h4.paragraphs-table-header__label { display: none; } -.field--widget-paragraphs .paragraphs-tabs-wrapper table.field-multiple-table table thead th.field-label h4 { - display: block; -} +/* Subform */ .paragraph-type--link .paragraphs-subform .field--name-field-link table.field-multiple-table:first-of-type thead { display: none; } diff --git a/modules/thunder_paragraphs/thunder_paragraphs.module b/modules/thunder_paragraphs/thunder_paragraphs.module index 269bdb884..b74974084 100644 --- a/modules/thunder_paragraphs/thunder_paragraphs.module +++ b/modules/thunder_paragraphs/thunder_paragraphs.module @@ -27,25 +27,18 @@ function thunder_paragraphs_field_widget_third_party_settings_form(WidgetInterfa } /** - * Implements hook_field_widget_single_element_WIDGET_TYPE_form_alter(). - * - * Used for Classic Paragraphs widget. + * Implements hook_preprocess_HOOK() for field_multiple_value_form. */ -function thunder_paragraphs_field_widgett_single_element_entity_reference_paragraphs_form_alter(array &$element, FormStateInterface $form_state, array $context): void { - thunder_paragraphs__attach_ief_submit( - $element, - [ - 'top', - 'links', - 'collapse_button', - ] - ); +function thunder_paragraphs_preprocess_field_multiple_value_form(&$variables) +{ + if (isset($variables['element']['#paragraphs_widget']) + && $variables['element']['#paragraphs_widget'] === TRUE + && isset($variables['table']['#header'][0]['data']['#attributes'])) { + $variables['table']['#header'][0]['data']['#attributes']->addClass('paragraphs-table-header__label'); + } } - /** * Implements hook_field_widget_single_element_WIDGET_TYPE_form_alter(). - * - * Used for Experimental Paragraphs widget. */ function thunder_paragraphs_field_widget_single_element_paragraphs_form_alter(array &$element, FormStateInterface $form_state, array $context): void { // Based on logic in ParagraphsWidget::formMultipleElements - execution of From 1814cd4a8a1a8f1304cd6f203ed4b7ca47db5dfa Mon Sep 17 00:00:00 2001 From: Volker Killesreiter Date: Tue, 7 May 2024 14:01:37 +0200 Subject: [PATCH 7/8] cbf --- modules/thunder_paragraphs/thunder_paragraphs.module | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/thunder_paragraphs/thunder_paragraphs.module b/modules/thunder_paragraphs/thunder_paragraphs.module index b74974084..613a1eb64 100644 --- a/modules/thunder_paragraphs/thunder_paragraphs.module +++ b/modules/thunder_paragraphs/thunder_paragraphs.module @@ -29,14 +29,14 @@ function thunder_paragraphs_field_widget_third_party_settings_form(WidgetInterfa /** * Implements hook_preprocess_HOOK() for field_multiple_value_form. */ -function thunder_paragraphs_preprocess_field_multiple_value_form(&$variables) -{ +function thunder_paragraphs_preprocess_field_multiple_value_form(&$variables) { if (isset($variables['element']['#paragraphs_widget']) && $variables['element']['#paragraphs_widget'] === TRUE && isset($variables['table']['#header'][0]['data']['#attributes'])) { - $variables['table']['#header'][0]['data']['#attributes']->addClass('paragraphs-table-header__label'); - } + $variables['table']['#header'][0]['data']['#attributes']->addClass('paragraphs-table-header__label'); + } } + /** * Implements hook_field_widget_single_element_WIDGET_TYPE_form_alter(). */ From 5f018861d7eb2abed735e3443998da0e582e9e57 Mon Sep 17 00:00:00 2001 From: Volker Killesreiter Date: Tue, 7 May 2024 14:37:19 +0200 Subject: [PATCH 8/8] fix dep --- modules/thunder_paragraphs/thunder_paragraphs.module | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/thunder_paragraphs/thunder_paragraphs.module b/modules/thunder_paragraphs/thunder_paragraphs.module index 613a1eb64..3d0a58c3a 100644 --- a/modules/thunder_paragraphs/thunder_paragraphs.module +++ b/modules/thunder_paragraphs/thunder_paragraphs.module @@ -29,7 +29,7 @@ function thunder_paragraphs_field_widget_third_party_settings_form(WidgetInterfa /** * Implements hook_preprocess_HOOK() for field_multiple_value_form. */ -function thunder_paragraphs_preprocess_field_multiple_value_form(&$variables) { +function thunder_paragraphs_preprocess_field_multiple_value_form(array &$variables): void { if (isset($variables['element']['#paragraphs_widget']) && $variables['element']['#paragraphs_widget'] === TRUE && isset($variables['table']['#header'][0]['data']['#attributes'])) {