Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Configuration/JavaScriptModules.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

return [
'dependencies' => [],
'imports' => [
'@beechit/default-upload-folder/' => 'EXT:default_upload_folder/Resources/Public/JavaScript/',
],
];
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,22 @@ Make it possible to configure the default upload folder for a certain TCA column
# You can set a default year/month/day folder within the set default folder
tx_news_domain_model_news.dateformat = 1
tx_news_domain_model_news = 1:news/{Y}/{m}

# You can use page variables like {title}, {subtitle} or {nav_title} to create dynamic folders
tt_content.assets.variableformat = 1
tt_content.assets = 1:user_upload/{title}/
}
```

****

**Path Preview**

The extension now displays the destination path directly in the backend for each upload field, providing immediate feedback on where files will be stored.

![backend_01](https://github.com/user-attachments/assets/e4351cda-02a7-4544-ae9f-13b960602c74)


**FAQ**

_What happens when the editor does not have access to the upload folder?_
Expand Down Expand Up @@ -84,4 +97,4 @@ _Why does the year/month/week/day feature not use the php strftime function & fo
> Specifically: https://docs.typo3.org/m/typo3/reference-coreapi/12.4/en-us/ApiOverview/Events/Events/Core/Resource/AfterDefaultUploadFolderWasResolvedEvent.html
>
> Added Services.yaml (as required for Event handling)
> Now receives $backendUserAuthentication directly from $GLOBALS['BE_USER'].
> Now receives $backendUserAuthentication directly from $GLOBALS['BE_USER'].
22 changes: 22 additions & 0 deletions Resources/Public/JavaScript/PathInfo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
document.addEventListener('DOMContentLoaded', function () {
if (!window.uploadFolderInfo) return;
Object.keys(window.uploadFolderInfo).forEach(function(field) {
var path = window.uploadFolderInfo[field];
var container = document.querySelector('.form-group[data-local-field="' + field + '"]');
if (!container) return;

if (!container.querySelector('.upload-folder-info')) {
var infoDiv = document.createElement('div');
infoDiv.className = 'upload-folder-info help-block';
infoDiv.style.marginBottom = '0';
infoDiv.innerHTML = '<div class="form-text">Standard Upload Ordner:<br> <span class="badge badge-success">' + path + '</span></div>';

var fileControls = container.querySelector('.form-control-wrap');
if (fileControls) {
fileControls.appendChild(infoDiv);
} else {
container.appendChild(infoDiv);
}
}
});
});