Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
if ($file_entity = FileType::load($value)) {
return $file_entity->label();
}
FileType::load() gets you a file type entity, not a file entity.
Comment | File | Size | Author |
---|---|---|---|
#5 | file_entity-confuse-variable-name-2718173-5.patch | 548 bytes | rashid_786 |
#2 | file_entity-confusing-variable-name-2718173-2.patch | 562 bytes | rashid_786 |
Comments
Comment #2
rashid_786 CreditAttribution: rashid_786 at SDG Corporation commentedpatch created with necessary changes.
Comment #4
BerdirTest fail is unrelated.
If we change it anyway, lets use just $file_type. the entity suffix is not necessary.
Comment #5
rashid_786 CreditAttribution: rashid_786 at SDG Corporation commentedChanges made as suggested.
Comment #8
BerdirThanks.
Comment #9
rashid_786 CreditAttribution: rashid_786 at SDG Corporation commented