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
3e5e3f46
Commit
3e5e3f46
authored
Nov 11, 2013
by
webchick
Browse files
Issue
#2124619
by alexpott: Stop creating user_picture() field programatically.
parent
acc31be4
Changes
9
Hide whitespace changes
Inline
Side-by-side
core/modules/comment/lib/Drupal/comment/Tests/CommentPreviewTest.php
View file @
3e5e3f46
...
...
@@ -15,11 +15,13 @@
class
CommentPreviewTest
extends
CommentTestBase
{
/**
*
Modu
le
s
to
enable
.
*
The profi
le to
install as a basis for testing
.
*
* @var array
* Using the standard profile to test user picture display in comments.
*
* @var string
*/
p
ublic
static
$modu
le
s
=
array
(
'image'
)
;
p
rotected
$profi
le
=
'standard'
;
public
static
function
getInfo
()
{
return
array
(
...
...
@@ -32,10 +34,6 @@ public static function getInfo() {
function
setUp
()
{
parent
::
setUp
();
// Create user picture field.
module_load_install
(
'user'
);
user_install_picture_field
();
// Add the basic_html filter format from the standard install profile.
$filter_format_storage_controller
=
$this
->
container
->
get
(
'entity.manager'
)
->
getStorageController
(
'filter_format'
);
$filter_format
=
$filter_format_storage_controller
->
create
(
array
(
...
...
core/modules/user/lib/Drupal/user/Tests/UserPictureTest.php
View file @
3e5e3f46
...
...
@@ -15,11 +15,14 @@
class
UserPictureTest
extends
WebTestBase
{
/**
*
Modu
le
s
to
enable
.
*
The profi
le to
install as a basis for testing
.
*
* @var array
* Using the standard profile to test user picture config provided by the
* standard profile.
*
* @var string
*/
p
ublic
static
$modu
le
s
=
array
(
'image'
,
'comment'
)
;
p
rotected
$profi
le
=
'standard'
;
protected
$user
;
protected
$_directory_test
;
...
...
@@ -41,12 +44,6 @@ function setUp() {
'post comments'
,
'skip comment approval'
,
));
$this
->
drupalCreateContentType
(
array
(
'type'
=>
'article'
,
'name'
=>
'Article'
));
$this
->
container
->
get
(
'comment.manager'
)
->
addDefaultField
(
'node'
,
'article'
);
// @see standard.install
module_load_install
(
'user'
);
user_install_picture_field
();
}
/**
...
...
core/modules/user/user.install
View file @
3e5e3f46
...
...
@@ -6,6 +6,7 @@
*/
use
Drupal\Core\Language\Language
;
use
Drupal\field\Field
;
/**
* Implements hook_schema().
...
...
@@ -255,97 +256,6 @@ function user_install() {
->
execute
();
}
/**
* Creates a user picture image field for the User entity.
*
* This is only used in core's standard.install, but is kept as a separate
* helper function so that other install profiles can reuse it.
*/
function
user_install_picture_field
()
{
$field
=
array
(
'name'
=>
'user_picture'
,
'entity_type'
=>
'user'
,
'module'
=>
'image'
,
'type'
=>
'image'
,
'cardinality'
=>
1
,
'locked'
=>
FALSE
,
'indexes'
=>
array
(
'target_id'
=>
array
(
'target_id'
)),
'settings'
=>
array
(
'uri_scheme'
=>
'public'
,
'default_image'
=>
array
(
'fid'
=>
NULL
,
'alt'
=>
''
,
'title'
=>
''
,
'width'
=>
NULL
,
'height'
=>
NULL
,
),
),
);
entity_create
(
'field_entity'
,
$field
)
->
save
();
$instance
=
array
(
'field_name'
=>
'user_picture'
,
'entity_type'
=>
'user'
,
'label'
=>
'Picture'
,
'bundle'
=>
'user'
,
'description'
=>
t
(
'Your virtual face or picture.'
),
'required'
=>
FALSE
,
'settings'
=>
array
(
'file_extensions'
=>
'png gif jpg jpeg'
,
'file_directory'
=>
'pictures'
,
'max_filesize'
=>
'30 KB'
,
'alt_field'
=>
0
,
'title_field'
=>
0
,
'max_resolution'
=>
'85x85'
,
'min_resolution'
=>
''
,
'default_image'
=>
array
(
'fid'
=>
NULL
,
'alt'
=>
''
,
'title'
=>
''
,
'width'
=>
NULL
,
'height'
=>
NULL
,
),
),
);
entity_create
(
'field_instance'
,
$instance
)
->
save
();
// Assign form display settings for the 'default' view mode.
entity_get_form_display
(
'user'
,
'user'
,
'default'
)
->
setComponent
(
'user_picture'
,
array
(
'type'
=>
'image_image'
,
'settings'
=>
array
(
'progress_indicator'
=>
'throbber'
,
'preview_image_style'
=>
'thumbnail'
,
),
'weight'
=>
-
1
,
))
->
save
();
// Assign display settings for the 'default' and 'compact' view modes.
entity_get_display
(
'user'
,
'user'
,
'default'
)
->
setComponent
(
'user_picture'
,
array
(
'label'
=>
'hidden'
,
'type'
=>
'image'
,
'settings'
=>
array
(
'image_style'
=>
'thumbnail'
,
'image_link'
=>
'content'
,
),
))
->
save
();
entity_get_display
(
'user'
,
'user'
,
'compact'
)
->
setComponent
(
'user_picture'
,
array
(
'label'
=>
'hidden'
,
'type'
=>
'image'
,
'settings'
=>
array
(
'image_style'
=>
'thumbnail'
,
'image_link'
=>
'content'
,
),
))
// Additionally, hide 'summary' pseudo-field from compact view mode..
->
removeComponent
(
'member_for'
)
->
save
();
}
/**
* Implements hook_update_dependencies().
*/
...
...
core/profiles/standard/config/entity.display.user.user.compact.yml
0 → 100644
View file @
3e5e3f46
id
:
user.user.compact
uuid
:
70911b08-bf47-4a3f-b400-f99cf136effd
targetEntityType
:
user
bundle
:
user
mode
:
compact
content
:
user_picture
:
label
:
hidden
type
:
image
settings
:
image_style
:
thumbnail
image_link
:
content
weight
:
0
member_for
:
visible
:
false
status
:
true
core/profiles/standard/config/entity.display.user.user.default.yml
0 → 100644
View file @
3e5e3f46
id
:
user.user.default
uuid
:
7a60b270-a584-46dc-ba00-a510230e9f45
targetEntityType
:
user
bundle
:
user
mode
:
default
content
:
user_picture
:
label
:
hidden
type
:
image
settings
:
image_style
:
thumbnail
image_link
:
content
weight
:
0
status
:
true
core/profiles/standard/config/entity.form_display.user.user.default.yml
0 → 100644
View file @
3e5e3f46
id
:
user.user.default
uuid
:
9a01a9bf-791b-4e46-8d32-50136be8596f
targetEntityType
:
user
bundle
:
user
mode
:
default
content
:
user_picture
:
type
:
image_image
settings
:
progress_indicator
:
throbber
preview_image_style
:
thumbnail
weight
:
-1
status
:
true
core/profiles/standard/config/field.field.user.user_picture.yml
0 → 100644
View file @
3e5e3f46
id
:
user.user_picture
uuid
:
745b0ce0-aece-42dd-a800-ade5b8455e84
status
:
true
langcode
:
en
name
:
user_picture
entity_type
:
user
type
:
image
settings
:
uri_scheme
:
public
default_image
:
false
column_groups
:
file
:
label
:
File
columns
:
-
target_id
-
width
-
height
alt
:
label
:
Alt
translatable
:
true
title
:
label
:
Title
translatable
:
true
module
:
image
active
:
true
locked
:
false
cardinality
:
1
translatable
:
false
indexes
:
target_id
:
-
target_id
core/profiles/standard/config/field.instance.user.user.user_picture.yml
0 → 100644
View file @
3e5e3f46
id
:
user.user.user_picture
uuid
:
1e125e81-5211-4c73-a500-c45099ab9014
status
:
true
langcode
:
en
field_uuid
:
745b0ce0-aece-42dd-a800-ade5b8455e84
entity_type
:
user
bundle
:
user
label
:
Picture
description
:
'
Your
virtual
face
or
picture.'
required
:
false
default_value
:
{
}
default_value_function
:
'
'
settings
:
file_extensions
:
'
png
gif
jpg
jpeg'
file_directory
:
pictures
max_filesize
:
'
30
KB'
alt_field
:
0
title_field
:
0
max_resolution
:
85x85
min_resolution
:
'
'
default_image
:
fid
:
null
alt
:
'
'
title
:
'
'
width
:
null
height
:
null
alt_field_required
:
'
0'
title_field_required
:
'
0'
field_type
:
image
core/profiles/standard/standard.install
View file @
3e5e3f46
...
...
@@ -31,10 +31,6 @@ function standard_install() {
$user_settings
=
\
Drupal
::
config
(
'user.settings'
);
$user_settings
->
set
(
'register'
,
USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL
)
->
save
();
// Create user picture field.
module_load_install
(
'user'
);
user_install_picture_field
();
// Enable default permissions for system roles.
user_role_grant_permissions
(
DRUPAL_ANONYMOUS_RID
,
array
(
'access content'
,
'access comments'
));
user_role_grant_permissions
(
DRUPAL_AUTHENTICATED_RID
,
array
(
'access content'
,
'access comments'
,
'post comments'
,
'skip comment approval'
));
...
...
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