From 0eb59c20c51538c79053ad9a4cb1eeb78cf7a940 Mon Sep 17 00:00:00 2001
From: Dries <dries@buytaert.net>
Date: Fri, 1 Jun 2012 12:45:18 -0400
Subject: [PATCH] - Patch #1415828 by BJ___, patrickd, nod_, damiankloip: made
 Tabledrag a library.

---
 core/includes/common.inc          |  3 +--
 core/modules/system/system.module | 12 ++++++++++++
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/core/includes/common.inc b/core/includes/common.inc
index be6cab9dbde2..29f1ef117ead 100644
--- a/core/includes/common.inc
+++ b/core/includes/common.inc
@@ -4901,8 +4901,7 @@ function drupal_add_tabledrag($table_id, $action, $relationship, $group, $subgro
     // Add the table drag JavaScript to the page before the module JavaScript
     // to ensure that table drag behaviors are registered before any module
     // uses it.
-    drupal_add_library('system', 'jquery.cookie');
-    drupal_add_js('core/misc/tabledrag.js', array('weight' => -1));
+    drupal_add_library('system', 'drupal.tabledrag');
     $js_added = TRUE;
   }
 
diff --git a/core/modules/system/system.module b/core/modules/system/system.module
index 4dfb6e429c30..53948302fa53 100644
--- a/core/modules/system/system.module
+++ b/core/modules/system/system.module
@@ -1218,6 +1218,18 @@ function system_library_info() {
     ),
   );
 
+  // Drupal's tabledrag library.
+  $libraries['drupal.tabledrag'] = array(
+    'title' => 'Drupal tabledrag',
+    'version' => VERSION,
+    'js' => array(
+      'core/misc/tabledrag.js' => array('group' => JS_LIBRARY, 'weight' => -1),
+    ),
+    'dependencies' => array(
+      array('system', 'jquery.cookie'),
+    ),
+  );
+
   // Drupal's collapsible fieldset.
   $libraries['drupal.collapse'] = array(
     'title' => 'Drupal collapsible fieldset',
-- 
GitLab