summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Pott2015-02-19 09:00:38 (GMT)
committerAlex Pott2015-02-19 09:00:38 (GMT)
commit4211782c7311b1b5bc7a698d9a583f3dbbfe2766 (patch)
tree5030ee1533fbaf8d2bbf4080f085a88c3a5b7773
parent90261479449965ae09615e91f135b4b5be2bc6e0 (diff)
Issue #2427323 by kgoel: Deprecate shortcut_set_assign_user and shortcut_set_unassign_user.
-rw-r--r--core/modules/shortcut/shortcut.module8
-rw-r--r--core/modules/shortcut/src/ShortcutSetStorage.php1
-rw-r--r--core/modules/shortcut/src/Tests/ShortcutSetsTest.php7
-rw-r--r--core/modules/shortcut/src/Tests/ShortcutTestBase.php2
4 files changed, 11 insertions, 7 deletions
diff --git a/core/modules/shortcut/shortcut.module b/core/modules/shortcut/shortcut.module
index 4dfa28f..9776fb4 100644
--- a/core/modules/shortcut/shortcut.module
+++ b/core/modules/shortcut/shortcut.module
@@ -6,10 +6,8 @@
*/
use Drupal\Core\Access\AccessResult;
-use Drupal\Component\Utility\UrlHelper;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Routing\RouteMatchInterface;
-use Drupal\Core\Routing\UrlMatcher;
use Drupal\Core\Url;
use Drupal\shortcut\Entity\ShortcutSet;
use Drupal\shortcut\ShortcutSetInterface;
@@ -118,6 +116,9 @@ function shortcut_set_switch_access($account = NULL) {
* An object representing the shortcut set.
* @param $account
* A user account that will be assigned to use the set.
+ *
+ * @deprecated in Drupal 8.x, will be removed before Drupal 9.0.
+ * Use \Drupal::entityManager()->getStorage('shortcut_set')->assignUser().
*/
function shortcut_set_assign_user($shortcut_set, $account) {
\Drupal::entityManager()
@@ -137,6 +138,9 @@ function shortcut_set_assign_user($shortcut_set, $account) {
* TRUE if the user was previously assigned to a shortcut set and has been
* successfully removed from it. FALSE if the user was already not assigned
* to any set.
+ *
+ * @deprecated in Drupal 8.x, will be removed before Drupal 9.0.
+ * Use \Drupal::entityManager()->getStorage('shortcut_set')->unassignUser().
*/
function shortcut_set_unassign_user($account) {
return (bool) \Drupal::entityManager()
diff --git a/core/modules/shortcut/src/ShortcutSetStorage.php b/core/modules/shortcut/src/ShortcutSetStorage.php
index d01608e..f575856 100644
--- a/core/modules/shortcut/src/ShortcutSetStorage.php
+++ b/core/modules/shortcut/src/ShortcutSetStorage.php
@@ -10,7 +10,6 @@ namespace Drupal\shortcut;
use Drupal\Component\Uuid\UuidInterface;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Config\Entity\ConfigEntityStorage;
-use Drupal\Core\Config\StorageInterface;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Language\LanguageManagerInterface;
diff --git a/core/modules/shortcut/src/Tests/ShortcutSetsTest.php b/core/modules/shortcut/src/Tests/ShortcutSetsTest.php
index c321bc4..be6c439 100644
--- a/core/modules/shortcut/src/Tests/ShortcutSetsTest.php
+++ b/core/modules/shortcut/src/Tests/ShortcutSetsTest.php
@@ -105,7 +105,7 @@ class ShortcutSetsTest extends ShortcutTestBase {
function testShortcutSetAssign() {
$new_set = $this->generateShortcutSet($this->randomMachineName());
- shortcut_set_assign_user($new_set, $this->shortcutUser);
+ \Drupal::entityManager()->getStorage('shortcut_set')->assignUser($new_set, $this->shortcutUser);
$current_set = shortcut_current_displayed_set($this->shortcutUser);
$this->assertTrue($new_set->id() == $current_set->id(), "Successfully switched another user's shortcut set.");
}
@@ -168,8 +168,9 @@ class ShortcutSetsTest extends ShortcutTestBase {
function testShortcutSetUnassign() {
$new_set = $this->generateShortcutSet($this->randomMachineName());
- shortcut_set_assign_user($new_set, $this->shortcutUser);
- shortcut_set_unassign_user($this->shortcutUser);
+ $shortcut_set_storage = \Drupal::entityManager()->getStorage('shortcut_set');
+ $shortcut_set_storage->assignUser($new_set, $this->shortcutUser);
+ $shortcut_set_storage->unassignUser($this->shortcutUser);
$current_set = shortcut_current_displayed_set($this->shortcutUser);
$default_set = shortcut_default_set($this->shortcutUser);
$this->assertTrue($current_set->id() == $default_set->id(), "Successfully unassigned another user's shortcut set.");
diff --git a/core/modules/shortcut/src/Tests/ShortcutTestBase.php b/core/modules/shortcut/src/Tests/ShortcutTestBase.php
index 20c0ce1..ae1b24a 100644
--- a/core/modules/shortcut/src/Tests/ShortcutTestBase.php
+++ b/core/modules/shortcut/src/Tests/ShortcutTestBase.php
@@ -92,7 +92,7 @@ abstract class ShortcutTestBase extends WebTestBase {
// Log in as admin and grab the default shortcut set.
$this->drupalLogin($this->adminUser);
$this->set = ShortcutSet::load('default');
- shortcut_set_assign_user($this->set, $this->adminUser);
+ \Drupal::entityManager()->getStorage('shortcut_set')->assignUser($this->set, $this->adminUser);
}
/**