Problem/Motivation

ImageItem extends from FileItem and inherits the defined properties from it, it however doesn't have a description or display, so those should be unset.

Noticed this in #2247885: Improve UI for fields with multiple properties and/or references

Proposed resolution

unset them.

Remaining tasks

User interface changes

API changes

Comments

berdir’s picture

Status: Active » Needs review
StatusFileSize
new1.57 KB
new765 bytes

Status: Needs review » Needs work

The last submitted patch, 1: image-item-properties-2248501-1-test-only.patch, failed testing.

The last submitted patch, 1: image-item-properties-2248501-1.patch, failed testing.

mbovan’s picture

Status: Needs work » Needs review
StatusFileSize
new1.09 KB
new1.9 KB
new1.17 KB

Rerolled and adapted to the latest core.

The last submitted patch, 5: imageitem_should_not-2248501-5-TEST-ONLY.patch, failed testing.

berdir’s picture

Status: Needs review » Needs work
+++ b/core/modules/image/src/Tests/ImageItemTest.php
@@ -115,6 +116,11 @@ public function testImageItem() {
-    $properties = $entity->getFieldDefinition('image_test')->getPropertyDefinitions();
+    $properties = FieldStorageConfig::loadByName($entity->getEntityTypeId(), 'image_test')->getPropertyDefinitions();

What you can do is $entity->getFieldDefinition()->getFieldStorageDefinition()

mbovan’s picture

Status: Needs work » Needs review
StatusFileSize
new1 KB
new1.65 KB
new853 bytes

Changed to $entity->getFieldDefinition('image_test')->getFieldStorageDefinition()->getPropertyDefinitions().

The last submitted patch, 8: imageitem_should_not-2248501-8-TEST-ONLY.patch, failed testing.

LKS90’s picture

Status: Needs review » Reviewed & tested by the community

Test works, the image formatter only has the requested fields now, looks good to go.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

I've confirmed this does not affect an image fields schema and therefore no upgrade path is required. This issue is a normal bug fix, and doesn't include any disruptive changes, so it is allowed per https://www.drupal.org/core/beta-changes. Committed e12fd0d and pushed to 8.0.x. Thanks!

  • alexpott committed e12fd0d on 8.0.x
    Issue #2248501 by mbovan, Berdir: ImageItem should not have description...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.