diff --git a/Configuration/JavaScriptModules.php b/Configuration/JavaScriptModules.php new file mode 100644 index 0000000..2b18ac2 --- /dev/null +++ b/Configuration/JavaScriptModules.php @@ -0,0 +1,8 @@ + [], + 'imports' => [ + '@beechit/default-upload-folder/' => 'EXT:default_upload_folder/Resources/Public/JavaScript/', + ], +]; diff --git a/README.md b/README.md index 4126f20..5dca39d 100644 --- a/README.md +++ b/README.md @@ -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. + + + + **FAQ** _What happens when the editor does not have access to the upload folder?_ @@ -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']. \ No newline at end of file +> Now receives $backendUserAuthentication directly from $GLOBALS['BE_USER']. diff --git a/Resources/Public/JavaScript/PathInfo.js b/Resources/Public/JavaScript/PathInfo.js new file mode 100644 index 0000000..ce98f45 --- /dev/null +++ b/Resources/Public/JavaScript/PathInfo.js @@ -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 = '