Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
e46d6bfa
Commit
e46d6bfa
authored
Dec 28, 2013
by
catch
Browse files
Issue
#2163035
by Berdir: Remove $user->theme and Drupal\user\Theme\UserNegotiator.
parent
0cecf582
Changes
11
Hide whitespace changes
Inline
Side-by-side
core/modules/text/lib/Drupal/text/Tests/Formatter/TextPlainUnitTest.php
View file @
e46d6bfa
...
...
@@ -49,7 +49,6 @@ function setUp() {
// Configure the theme system.
$this
->
installConfig
(
array
(
'system'
,
'field'
));
$this
->
installSchema
(
'entity_test'
,
'entity_test'
);
$this
->
installSchema
(
'user'
,
'users'
);
// @todo Add helper methods for all of the following.
...
...
core/modules/user/lib/Drupal/user/Entity/User.php
View file @
e46d6bfa
...
...
@@ -266,13 +266,6 @@ public function setEmail($mail) {
return
$this
;
}
/**
* {@inheritdoc}
*/
public
function
getDefaultTheme
()
{
return
$this
->
get
(
'theme'
)
->
value
;
}
/**
* {@inheritdoc}
*/
...
...
@@ -482,11 +475,6 @@ public static function baseFieldDefinitions($entity_type) {
->
setLabel
(
t
(
'Signature format'
))
->
setDescription
(
t
(
'The signature format of this user.'
));
$fields
[
'theme'
]
=
FieldDefinition
::
create
(
'string'
)
->
setLabel
(
t
(
'Theme'
))
->
setDescription
(
t
(
'The default theme of this user.'
))
->
setPropertyConstraints
(
'value'
,
array
(
'Length'
=>
array
(
'max'
=>
DRUPAL_EXTENSION_NAME_MAX_LENGTH
)));
$fields
[
'timezone'
]
=
FieldDefinition
::
create
(
'string'
)
->
setLabel
(
t
(
'Timezone'
))
->
setDescription
(
t
(
'The timezone of this user.'
))
...
...
core/modules/user/lib/Drupal/user/Tests/UserRegistrationTest.php
View file @
e46d6bfa
...
...
@@ -182,7 +182,6 @@ function testRegistrationDefaultValues() {
$new_user
=
reset
(
$accounts
);
$this
->
assertEqual
(
$new_user
->
getUsername
(),
$name
,
'Username matches.'
);
$this
->
assertEqual
(
$new_user
->
getEmail
(),
$mail
,
'E-mail address matches.'
);
$this
->
assertEqual
(
$new_user
->
theme
->
value
,
''
,
'Correct theme field.'
);
$this
->
assertEqual
(
$new_user
->
getSignature
(),
''
,
'Correct signature field.'
);
$this
->
assertTrue
((
$new_user
->
getCreatedTime
()
>
REQUEST_TIME
-
20
),
'Correct creation time.'
);
$this
->
assertEqual
(
$new_user
->
isActive
(),
$config_user_settings
->
get
(
'register'
)
==
USER_REGISTER_VISITORS
?
1
:
0
,
'Correct status field.'
);
...
...
core/modules/user/lib/Drupal/user/Tests/UserValidationTest.php
View file @
e46d6bfa
...
...
@@ -125,10 +125,6 @@ function testValidation() {
$this
->
assertLengthViolation
(
$user
,
'signature'
,
255
);
$user
->
set
(
'signature'
,
NULL
);
$user
->
set
(
'theme'
,
$this
->
randomString
(
DRUPAL_EXTENSION_NAME_MAX_LENGTH
+
1
));
$this
->
assertLengthViolation
(
$user
,
'theme'
,
DRUPAL_EXTENSION_NAME_MAX_LENGTH
);
$user
->
set
(
'theme'
,
NULL
);
$user
->
set
(
'timezone'
,
$this
->
randomString
(
33
));
$this
->
assertLengthViolation
(
$user
,
'timezone'
,
32
);
$user
->
set
(
'timezone'
,
NULL
);
...
...
core/modules/user/lib/Drupal/user/Theme/UserNegotiator.php
deleted
100644 → 0
View file @
0cecf582
<?php
/**
* @file
* Contains \Drupal\user\Theme\UserNegotiator.
*/
namespace
Drupal\user\Theme
;
use
Drupal\Core\Entity\EntityManager
;
use
Drupal\Core\Session\AccountInterface
;
use
Drupal\Core\Theme\ActiveTheme
;
use
Drupal\Core\Theme\ThemeNegotiatorInterface
;
use
Symfony\Component\HttpFoundation\Request
;
/**
* Defines the theme negotiator service for theme configured per user.
*/
class
UserNegotiator
implements
ThemeNegotiatorInterface
{
/**
* The user storage controller.
*
* @var \Drupal\user\UserStorageControllerInterface
*/
protected
$userStorageController
;
/**
* The current user.
*
* @var \Drupal\Core\Session\AccountInterface
*/
protected
$currentUser
;
/**
* Constructs a UserNegotiator object.
*
* @param \Drupal\Core\Entity\EntityManager $entity_manager
* The entity manager
* @param \Drupal\Core\Session\AccountInterface $current_user
* The current user.
*/
public
function
__construct
(
EntityManager
$entity_manager
,
AccountInterface
$current_user
)
{
$this
->
userStorageController
=
$entity_manager
->
getStorageController
(
'user'
);
$this
->
currentUser
=
$current_user
;
}
/**
* {@inheritdoc}
*/
public
function
applies
(
Request
$request
)
{
return
TRUE
;
}
/**
* {@inheritdoc}
*/
public
function
determineActiveTheme
(
Request
$request
)
{
if
(
$user
=
$this
->
userStorageController
->
load
(
$this
->
currentUser
->
id
()))
{;
// Only select the user selected theme if it is available in the
// list of themes that can be accessed.
if
(
!
empty
(
$user
->
theme
)
&&
drupal_theme_access
(
$user
->
theme
))
{
return
$user
->
theme
;
}
}
}
}
core/modules/user/lib/Drupal/user/UserInterface.php
View file @
e46d6bfa
...
...
@@ -83,14 +83,6 @@ public function setPassword($password);
*/
public
function
setEmail
(
$mail
);
/**
* Returns the default theme of the user.
*
* @return string
* Name of the theme.
*/
public
function
getDefaultTheme
();
/**
* Returns the user signature.
*
...
...
core/modules/user/user.install
View file @
e46d6bfa
...
...
@@ -58,13 +58,6 @@ function user_schema() {
'default'
=>
''
,
'description'
=>
"User's e-mail address."
,
),
'theme'
=>
array
(
'type'
=>
'varchar'
,
'length'
=>
DRUPAL_EXTENSION_NAME_MAX_LENGTH
,
'not null'
=>
TRUE
,
'default'
=>
''
,
'description'
=>
"User's default theme."
,
),
'signature'
=>
array
(
'type'
=>
'varchar'
,
'length'
=>
255
,
...
...
@@ -998,16 +991,6 @@ function user_update_8019() {
db_change_field
(
'users_data'
,
'module'
,
'module'
,
$spec
);
}
if
(
db_field_exists
(
'users'
,
'theme'
))
{
$spec
=
array
(
'type'
=>
'varchar'
,
'length'
=>
50
,
'not null'
=>
TRUE
,
'default'
=>
''
,
'description'
=>
"User's default theme."
,
);
db_change_field
(
'users'
,
'theme'
,
'theme'
,
$spec
);
}
}
/**
...
...
core/modules/user/user.services.yml
View file @
e46d6bfa
...
...
@@ -25,11 +25,6 @@ services:
class
:
Drupal\user\EventSubscriber\MaintenanceModeSubscriber
tags
:
-
{
name
:
event_subscriber
}
theme.negotiator.user
:
class
:
Drupal\user\Theme\UserNegotiator
arguments
:
[
'
@entity.manager'
,
'
@current_user'
]
tags
:
-
{
name
:
theme_negotiator
,
priority
:
-50
}
theme.negotiator.admin_theme
:
class
:
Drupal\user\Theme\AdminNegotiator
arguments
:
[
'
@current_user'
,
'
@config.factory'
,
'
@entity.manager'
]
...
...
core/modules/views/lib/Drupal/views/Tests/Handler/FieldCounterTest.php
View file @
e46d6bfa
...
...
@@ -19,7 +19,7 @@ class FieldCounterTest extends ViewUnitTestBase {
*
* @var array
*/
public
static
$modules
=
array
(
'user'
,
'field'
);
public
static
$modules
=
array
(
'user'
);
/**
* Views used by this test.
...
...
@@ -36,12 +36,6 @@ public static function getInfo() {
);
}
protected
function
setUp
()
{
parent
::
setUp
();
$this
->
installSchema
(
'user'
,
'users'
);
}
function
testSimple
()
{
$view
=
views_get_view
(
'test_view'
);
$view
->
setDisplay
();
...
...
core/modules/views/lib/Drupal/views/Tests/Handler/FieldUnitTest.php
View file @
e46d6bfa
...
...
@@ -17,7 +17,7 @@
*/
class
FieldUnitTest
extends
ViewUnitTestBase
{
public
static
$modules
=
array
(
'user'
,
'field'
);
public
static
$modules
=
array
(
'user'
);
/**
* Views used by this test.
...
...
@@ -38,12 +38,6 @@ public static function getInfo() {
);
}
protected
function
setUp
()
{
parent
::
setUp
();
$this
->
installSchema
(
'user'
,
'users'
);
}
/**
* Overrides Drupal\views\Tests\ViewTestBase::viewsData().
*/
...
...
core/modules/views/lib/Drupal/views/Tests/Plugin/DisplayPageTest.php
View file @
e46d6bfa
...
...
@@ -59,7 +59,6 @@ protected function setUp() {
// Setup the needed tables in order to make the drupal router working.
$this
->
installSchema
(
'system'
,
array
(
'router'
,
'menu_router'
,
'url_alias'
));
$this
->
installSchema
(
'menu_link'
,
'menu_links'
);
$this
->
installSchema
(
'user'
,
'users'
);
}
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment