diff --git a/core/lib/Drupal/Component/Utility/SortArray.php b/core/lib/Drupal/Component/Utility/SortArray.php
index 92763f5..bdbb569 100644
--- a/core/lib/Drupal/Component/Utility/SortArray.php
+++ b/core/lib/Drupal/Component/Utility/SortArray.php
@@ -91,6 +91,31 @@ public static function sortByTitleProperty($a, $b) {
    }
 
   /**
+   * Sorts a structured array firstly by weight, then by title.
+   *
+   * @param array $a
+   *   The first item to compare.
+   * @param array $b
+   *   The second item to compare.
+   * @param string $weight_key
+   *   (optional) The weight key to use. Defaults to 'weight'.
+   * @param string $title_key
+   *   (optional) The title key to use. Defaults to 'title'.
+   *
+   * @return int
+   *   The comparison result for uasort().
+   */
+  public static function sortByWeightAndTitleKey($a, $b, $weight_key = 'weight', $title_key = 'title') {
+    $weight_cmp = static::sortByKeyInt($a, $b, $weight_key);
+
+    if ($weight_cmp === 0) {
+      return static::sortByKeyString($a, $b, $title_key);
+    }
+
+    return $weight_cmp;
+  }
+
+  /**
    * Sorts a string array item by an arbitrary key.
    *
    * @param array $a
diff --git a/core/tests/Drupal/Tests/Component/Utility/SortArrayTest.php b/core/tests/Drupal/Tests/Component/Utility/SortArrayTest.php
index 38e5045..c127ddb 100644
--- a/core/tests/Drupal/Tests/Component/Utility/SortArrayTest.php
+++ b/core/tests/Drupal/Tests/Component/Utility/SortArrayTest.php
@@ -323,4 +323,77 @@ public function providerSortByTitleProperty() {
     return $tests;
   }
 
+  /**
+   * Tests SortArray::sortByWeightAndTitleKey() input against expected output.
+   *
+   * @dataProvider providerTestSortByWeightAndTitleKey
+   *
+   * @param array $a
+   *   The first input item for comparison.
+   * @param array $b
+   *   The second item for comparison.
+   * @param integer $expected
+   *   The expected output from calling the method.
+   */
+  public function testSortByWeightAndTitleKey($a, $b, $expected) {
+    $result = SortArray::sortByWeightAndTitleKey($a, $b);
+    $this->assertEquals($expected, $result);
+  }
+
+  /**
+   * Data provider for testSortByWeightAndTitleKey.
+   *
+   * @return array
+   *   An array of test data.
+   */
+  public function providerTestSortByWeightAndTitleKey() {
+    return array(
+      array(
+        array(),
+        array(),
+        0
+      ),
+      array(
+        array('weight' => 1),
+        array('weight' => 2),
+        -1
+      ),
+      array(
+        array('weight' => 2),
+        array('weight' => 1),
+        1
+      ),
+      array(
+        array('title' => 'b', 'weight' => 1),
+        array('title' => 'a', 'weight' => 2),
+        -1
+      ),
+      array(
+        array('title' => 'a', 'weight' => 2),
+        array('title' => 'b', 'weight' => 1),
+        1
+      ),
+      array(
+        array('title' => 'a', 'weight' => 1),
+        array('title' => 'b', 'weight' => 1),
+        -1
+      ),
+      array(
+        array('title' => 'b', 'weight' => 1),
+        array('title' => 'a', 'weight' => 1),
+        1
+      ),
+      array(
+        array('title' => 'a'),
+        array('title' => 'b'),
+        -1
+      ),
+      array(
+        array('title' => 'A'),
+        array('title' => 'a'),
+        0
+      ),
+    );
+  }
+
 }
