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
e12fd0d0
Commit
e12fd0d0
authored
Sep 07, 2015
by
alexpott
Browse files
Issue
#2248501
by mbovan, Berdir: ImageItem should not have description and display properties
parent
0b132ec5
Changes
2
Hide whitespace changes
Inline
Side-by-side
core/modules/image/src/Plugin/Field/FieldType/ImageItem.php
View file @
e12fd0d0
...
...
@@ -145,6 +145,9 @@ public static function schema(FieldStorageDefinitionInterface $field_definition)
public
static
function
propertyDefinitions
(
FieldStorageDefinitionInterface
$field_definition
)
{
$properties
=
parent
::
propertyDefinitions
(
$field_definition
);
unset
(
$properties
[
'display'
]);
unset
(
$properties
[
'description'
]);
$properties
[
'alt'
]
=
DataDefinition
::
create
(
'string'
)
->
setLabel
(
t
(
'Alternative text'
))
->
setDescription
(
t
(
"Alternative image text, for the image's 'alt' attribute."
));
...
...
core/modules/image/src/Tests/ImageItemTest.php
View file @
e12fd0d0
...
...
@@ -115,6 +115,11 @@ public function testImageItem() {
$entity
=
entity_create
(
'entity_test'
,
array
(
'mame'
=>
$this
->
randomMachineName
()));
$entity
->
save
();
// Test image item properties.
$expected
=
array
(
'target_id'
,
'entity'
,
'alt'
,
'title'
,
'width'
,
'height'
);
$properties
=
$entity
->
getFieldDefinition
(
'image_test'
)
->
getFieldStorageDefinition
()
->
getPropertyDefinitions
();
$this
->
assertEqual
(
array_keys
(
$properties
),
$expected
);
// Test the generateSampleValue() method.
$entity
=
entity_create
(
'entity_test'
);
$entity
->
image_test
->
generateSampleItems
();
...
...
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