Commit 4211782c authored by alexpott's avatar alexpott

Issue #2427323 by kgoel: Deprecate shortcut_set_assign_user and shortcut_set_unassign_user.

parent 90261479
......@@ -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()
......
......@@ -10,7 +10,6 @@
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;
......
......@@ -105,7 +105,7 @@ function testShortcutSetSwitchOwn() {
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 @@ function testShortcutSetRenameAlreadyExists() {
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.");
......
......@@ -92,7 +92,7 @@ protected function setUp() {
// 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);
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment