getUploadLocation() does not reflect Filefield Paths configuration

Created on 10 June 2025, 14 days ago

Problem/Motivation

Not sure if this is something that Filefield Paths can or should address, but when it is configured for a field the expected result for the file item from that field gives incorrect values.

Steps to reproduce

use Drupal\Core\Field\TypedData\FieldItemDataDefinition;
use Drupal\file\Plugin\Field\FieldType\FileItem;

    // Create a file item to get the upload location.
    $media_type = \Drupal\media\Entity\MediaType::load($media->bundle());
    $field_definition = $media_type->getSource()->getSourceFieldDefinition($media_type);
    $data_definition = FieldItemDataDefinition::create($field_definition);
    $item = new FileItem($data_definition);
    $upload_location = $item->getUploadLocation();

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States mlncn Minneapolis, MN, USA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024