Skip to content

Instantly share code, notes, and snippets.

@junaidpv
Created October 10, 2024 20:23
Show Gist options
  • Save junaidpv/e1a4a4c74bc8815d21d10da91ab16478 to your computer and use it in GitHub Desktop.
Save junaidpv/e1a4a4c74bc8815d21d10da91ab16478 to your computer and use it in GitHub Desktop.
Make tables non-sticky in the webform module. Keep this patch until https://www.drupal.org/project/drupal/issues/3414067 it is resolved.
diff --git a/modules/webform_access/src/WebformAccessGroupListBuilder.php b/modules/webform_access/src/WebformAccessGroupListBuilder.php
index 7c731d4f1..83e0c3ef2 100644
--- a/modules/webform_access/src/WebformAccessGroupListBuilder.php
+++ b/modules/webform_access/src/WebformAccessGroupListBuilder.php
@@ -64,7 +64,7 @@ class WebformAccessGroupListBuilder extends ConfigEntityListBuilder {
// Table.
$build += parent::render();
- $build['table']['#sticky'] = TRUE;
+ $build['table']['#sticky'] = FALSE;
$build['table']['#attributes']['class'][] = 'webform-access-group-table';
// Attachments.
diff --git a/modules/webform_access/src/WebformAccessTypeListBuilder.php b/modules/webform_access/src/WebformAccessTypeListBuilder.php
index 2991de0b7..a8a60f3cd 100644
--- a/modules/webform_access/src/WebformAccessTypeListBuilder.php
+++ b/modules/webform_access/src/WebformAccessTypeListBuilder.php
@@ -46,7 +46,7 @@ class WebformAccessTypeListBuilder extends ConfigEntityListBuilder {
// Table.
$build += parent::render();
- $build['table']['#sticky'] = TRUE;
+ $build['table']['#sticky'] = FALSE;
// Attachments.
$build['#attached']['library'][] = 'webform/webform.admin.dialog';
diff --git a/modules/webform_image_select/src/WebformImageSelectImagesListBuilder.php b/modules/webform_image_select/src/WebformImageSelectImagesListBuilder.php
index 18f45319c..046441850 100644
--- a/modules/webform_image_select/src/WebformImageSelectImagesListBuilder.php
+++ b/modules/webform_image_select/src/WebformImageSelectImagesListBuilder.php
@@ -85,7 +85,7 @@ class WebformImageSelectImagesListBuilder extends ConfigEntityListBuilder {
// Table.
$build += parent::render();
- $build['table']['#sticky'] = TRUE;
+ $build['table']['#sticky'] = FALSE;
// Attachments.
$build['#attached']['library'][] = 'webform/webform.tooltip';
diff --git a/modules/webform_node/src/Controller/WebformNodeReferencesListController.php b/modules/webform_node/src/Controller/WebformNodeReferencesListController.php
index d7cfd1ec5..acb444e62 100644
--- a/modules/webform_node/src/Controller/WebformNodeReferencesListController.php
+++ b/modules/webform_node/src/Controller/WebformNodeReferencesListController.php
@@ -347,7 +347,7 @@ class WebformNodeReferencesListController extends EntityListBuilder implements C
$build += parent::render();
- $build['table']['#sticky'] = TRUE;
+ $build['table']['#sticky'] = FALSE;
// Customize the empty message.
$build['table']['#empty'] = $this->t('There are no webform node references.');
diff --git a/modules/webform_options_custom/src/WebformOptionsCustomListBuilder.php b/modules/webform_options_custom/src/WebformOptionsCustomListBuilder.php
index e0e3cd6a1..a6d5fe738 100644
--- a/modules/webform_options_custom/src/WebformOptionsCustomListBuilder.php
+++ b/modules/webform_options_custom/src/WebformOptionsCustomListBuilder.php
@@ -90,7 +90,7 @@ class WebformOptionsCustomListBuilder extends ConfigEntityListBuilder {
// Table.
$build += parent::render();
- $build['table']['#sticky'] = TRUE;
+ $build['table']['#sticky'] = FALSE;
// Attachments.
$build['#attached']['library'][] = 'webform/webform.tooltip';
diff --git a/modules/webform_submission_log/src/Controller/WebformSubmissionLogController.php b/modules/webform_submission_log/src/Controller/WebformSubmissionLogController.php
index f56cdcbad..2b1dadfb2 100644
--- a/modules/webform_submission_log/src/Controller/WebformSubmissionLogController.php
+++ b/modules/webform_submission_log/src/Controller/WebformSubmissionLogController.php
@@ -170,7 +170,7 @@ class WebformSubmissionLogController extends ControllerBase {
'#type' => 'table',
'#header' => $header,
'#rows' => $rows,
- '#sticky' => TRUE,
+ '#sticky' => FALSE,
'#empty' => $this->t('No log messages available.'),
];
$build['pager'] = ['#type' => 'pager'];
diff --git a/modules/webform_templates/src/Controller/WebformTemplatesController.php b/modules/webform_templates/src/Controller/WebformTemplatesController.php
index 244182b41..cefdfc9fc 100644
--- a/modules/webform_templates/src/Controller/WebformTemplatesController.php
+++ b/modules/webform_templates/src/Controller/WebformTemplatesController.php
@@ -164,7 +164,7 @@ class WebformTemplatesController extends ControllerBase implements ContainerInje
'#type' => 'table',
'#header' => $header,
'#rows' => $rows,
- '#sticky' => TRUE,
+ '#sticky' => FALSE,
'#empty' => $this->t('There are no templates available.'),
'#cache' => [
'contexts' => $this->getWebformStorage()->getEntityType()->getListCacheContexts(),
diff --git a/src/Controller/WebformPluginElementController.php b/src/Controller/WebformPluginElementController.php
index 9c6ba7174..c751214b2 100644
--- a/src/Controller/WebformPluginElementController.php
+++ b/src/Controller/WebformPluginElementController.php
@@ -314,7 +314,7 @@ class WebformPluginElementController extends ControllerBase implements Container
$this->t('Operations'),
],
'#rows' => $webform_form_element_rows,
- '#sticky' => TRUE,
+ '#sticky' => FALSE,
'#attributes' => [
'class' => ['webform-element-plugin-table'],
],
@@ -332,7 +332,7 @@ class WebformPluginElementController extends ControllerBase implements Container
$this->t('Provided by'),
],
'#rows' => $element_rows,
- '#sticky' => TRUE,
+ '#sticky' => FALSE,
],
];
diff --git a/src/Controller/WebformPluginExporterController.php b/src/Controller/WebformPluginExporterController.php
index f0fa3afe2..aae8ff1b0 100644
--- a/src/Controller/WebformPluginExporterController.php
+++ b/src/Controller/WebformPluginExporterController.php
@@ -99,7 +99,7 @@ class WebformPluginExporterController extends ControllerBase implements Containe
$this->t('Provided by'),
],
'#rows' => $rows,
- '#sticky' => TRUE,
+ '#sticky' => FALSE,
'#attributes' => [
'class' => ['webform-exporter-plugin-table'],
],
diff --git a/src/Controller/WebformPluginHandlerController.php b/src/Controller/WebformPluginHandlerController.php
index 7a643b1f9..1f085e4bc 100644
--- a/src/Controller/WebformPluginHandlerController.php
+++ b/src/Controller/WebformPluginHandlerController.php
@@ -125,7 +125,7 @@ class WebformPluginHandlerController extends ControllerBase implements Container
$this->t('Provided by'),
],
'#rows' => $rows,
- '#sticky' => TRUE,
+ '#sticky' => FALSE,
'#attributes' => [
'class' => ['webform-handler-plugin-table'],
],
diff --git a/src/Controller/WebformPluginVariantController.php b/src/Controller/WebformPluginVariantController.php
index 81d49d793..d58c90360 100644
--- a/src/Controller/WebformPluginVariantController.php
+++ b/src/Controller/WebformPluginVariantController.php
@@ -128,7 +128,7 @@ class WebformPluginVariantController extends ControllerBase implements Container
$this->t('Provided by'),
],
'#rows' => $rows,
- '#sticky' => TRUE,
+ '#sticky' => FALSE,
'#attributes' => [
'class' => ['webform-variant-plugin-table'],
],
@@ -236,7 +236,7 @@ class WebformPluginVariantController extends ControllerBase implements Container
'#type' => 'table',
'#header' => $headers,
'#rows' => $rows,
- '#sticky' => TRUE,
+ '#sticky' => FALSE,
'#empty' => $this->t('No variant available.'),
'#attributes' => [
'class' => ['webform-variant-add-table'],
diff --git a/src/Element/WebformLikert.php b/src/Element/WebformLikert.php
index fd1672a3a..5de041543 100644
--- a/src/Element/WebformLikert.php
+++ b/src/Element/WebformLikert.php
@@ -33,7 +33,7 @@ class WebformLikert extends FormElement {
'#theme_wrappers' => ['form_element'],
'#required' => FALSE,
'#required_error' => '',
- '#sticky' => TRUE,
+ '#sticky' => FALSE,
'#questions' => [],
'#questions_description_display' => 'description',
// Using #answers instead of #options to prevent triggering
diff --git a/src/Form/AdminConfig/WebformAdminConfigBaseForm.php b/src/Form/AdminConfig/WebformAdminConfigBaseForm.php
index bbe4375c6..b1a6aad37 100644
--- a/src/Form/AdminConfig/WebformAdminConfigBaseForm.php
+++ b/src/Form/AdminConfig/WebformAdminConfigBaseForm.php
@@ -207,7 +207,7 @@ abstract class WebformAdminConfigBaseForm extends ConfigFormBase {
'#header' => $header,
'#options' => $options,
'#required' => TRUE,
- '#sticky' => TRUE,
+ '#sticky' => FALSE,
'#default_value' => array_diff($ids, $excluded_ids),
];
TableSelect::setProcessTableSelectCallback($element);
diff --git a/src/Form/AdminConfig/WebformAdminConfigElementsForm.php b/src/Form/AdminConfig/WebformAdminConfigElementsForm.php
index fca600fa2..6f955ce29 100644
--- a/src/Form/AdminConfig/WebformAdminConfigElementsForm.php
+++ b/src/Form/AdminConfig/WebformAdminConfigElementsForm.php
@@ -495,7 +495,7 @@ class WebformAdminConfigElementsForm extends WebformAdminConfigBaseForm {
'item' => ['data' => $this->t('Item format'), 'width' => '25%'],
'items' => ['data' => $this->t('Items format'), 'width' => '25%'],
],
- '#sticky' => TRUE,
+ '#sticky' => FALSE,
] + $rows;
return parent::buildForm($form, $form_state);
diff --git a/src/WebformEntityListBuilder.php b/src/WebformEntityListBuilder.php
index 827110be1..8cce2e88e 100644
--- a/src/WebformEntityListBuilder.php
+++ b/src/WebformEntityListBuilder.php
@@ -169,7 +169,7 @@ class WebformEntityListBuilder extends ConfigEntityListBuilder {
// Table.
$build += parent::render();
- $build['table']['#sticky'] = TRUE;
+ $build['table']['#sticky'] = FALSE;
$build['table']['#attributes']['class'][] = 'webform-forms';
// Bulk operations.
diff --git a/src/WebformOptionsListBuilder.php b/src/WebformOptionsListBuilder.php
index 6186637ab..945bb5dd1 100644
--- a/src/WebformOptionsListBuilder.php
+++ b/src/WebformOptionsListBuilder.php
@@ -86,7 +86,7 @@ class WebformOptionsListBuilder extends ConfigEntityListBuilder {
// Table.
$build += parent::render();
- $build['table']['#sticky'] = TRUE;
+ $build['table']['#sticky'] = FALSE;
// Attachments.
$build['#attached']['library'][] = 'webform/webform.admin.dialog';
diff --git a/src/WebformSubmissionListBuilder.php b/src/WebformSubmissionListBuilder.php
index a865dc848..ad9b89ab3 100644
--- a/src/WebformSubmissionListBuilder.php
+++ b/src/WebformSubmissionListBuilder.php
@@ -565,7 +565,7 @@ class WebformSubmissionListBuilder extends EntityListBuilder {
// Table.
$build += parent::render();
- $build['table']['#sticky'] = TRUE;
+ $build['table']['#sticky'] = FALSE;
$build['table']['#attributes']['class'][] = 'webform-results-table';
// Bulk operations only visible on webform submissions pages.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment