- Issue created by @mlncn
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.
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();
Active
1.0
Code