From 3e76c4ca4ced5d31600d321a926ccb20fe069abf Mon Sep 17 00:00:00 2001
From: Ide Braakman <ide@ezcompany.nl>
Date: Thu, 8 Feb 2018 14:38:58 +0100
Subject: [PATCH] Issue #2943237 by idebr: Make webform overview compatible
 with tablesorting

---
 src/WebformEntityListBuilder.php | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/WebformEntityListBuilder.php b/src/WebformEntityListBuilder.php
index f0d2cf95..a946c46e 100644
--- a/src/WebformEntityListBuilder.php
+++ b/src/WebformEntityListBuilder.php
@@ -145,6 +145,9 @@ class WebformEntityListBuilder extends ConfigEntityListBuilder {
   public function buildHeader() {
     $header['title'] = [
       'data' => $this->t('Title'),
+      'specifier' => 'title',
+      'field' => 'title',
+      'sort' => 'desc',
     ];
     $header['description'] = [
       'data' => $this->t('Description'),
@@ -170,9 +173,8 @@ class WebformEntityListBuilder extends ConfigEntityListBuilder {
       'data' => $this->t('Operations'),
       'class' => [RESPONSIVE_PRIORITY_MEDIUM],
     ];
-    $header['operations'] = [
-      'data' => '',
-    ];
+    $header['operations'] = '';
+
     return $header;
   }
 
@@ -298,8 +300,9 @@ class WebformEntityListBuilder extends ConfigEntityListBuilder {
    * {@inheritdoc}
    */
   protected function getEntityIds() {
+    $header = $this->buildHeader();
     return $this->getQuery($this->keys, $this->category, $this->state)
-      ->sort('title')
+      ->tableSort($header)
       ->pager($this->getLimit())
       ->execute();
   }
-- 
2.11.0 (Apple Git-81)

