Update TemplateModel.php#40712
Update TemplateModel.php#40712BrainforgeUK wants to merge 2 commits intojoomla:4.3-devfrom BrainforgeUK:patch-13
Conversation
Allows admin to add files to an empty template media folder.
Corrected comment.
|
Once again, if you want to handle this do it in the template adapter not in the template manager! |
|
this pr has been already rejected once see #40667 for reference feel free to describe in more details what this pr is trying to solve |
|
Please reopen this PR and read the comments in the code and explain what the problem is with it. (a) As a compromise I could remove the mkdir and instead display a message such as (b) I could add a change to the template adapter so that templates with missing media content are rejected. Which takes us back to (a) above. The developer creates a template without any media why stop the site admin adding some through the template manager? Should they have a create media button in the template manager? (c) What purpose does the bizarre unwrittable media folder check / message serve? Any number of media files / folders could be write protected - just leave it for a sensible error message when site admin tries to make changes ... I have not checked what happens if the file or folder is not writtable. Ok I am willing to make that compromise in (a) but really I don't see the point. I suggest that this PR be reopened asis and either further changes made to address the above issues or once it has been pushed onto core a new issue created to investigate this matter further. |
|
Or you can provide a proper media section in the xml and not have any of these problems… |
|
Having a proper media section in the XML does not solve anything! (d) Site admin can still use the template manager to remove all existing media content, they are then unable to add media content to the template. |
|
if you remove the folders inside the media folder then the media folder itself disappears from the template manager chrome_2023-06-04_20-38-43.mp4 |
That's baggages from the past and the reason I added all these empty folders... Actually that's a bug, @brianteeman please test #40719 |
|
I think my solution improves on what is there already. |

Allows admin to add files to an empty template media folder.
Pull Request for Issue #40666 .
Summary of Changes
Allow admin to add files / folders to empty template media folder.
The admin might have deleted (accidently or intentionally) all template media content.
See admin Templates: Customise page.
Similarly admin can add media to a template which did not have any in the first place.
Should installation of templates without media be disallowed? Not addressed by this PR.
Testing Instructions
Install a template and use the admin Templates: Customise page to delete all the files / folders for that template.
Check that on the adminTemplates: Customise page the media folder is still accessible and more media files / folders can be added.
Similarly add a template without a media section and check that media files / folders can be added by the admin.
tpl_cassiopeia_test1.zip
Actual result BEFORE applying this Pull Request
Cannot add media files / folders to a template when the template media folder is empty.
When the template media folder is empty there is a misleading message about the media template folder not being writtable ... it is writtable but empty!
Expected result AFTER applying this Pull Request
Use the admin Templates: Customise page to delete template media files / folders and when all have been deleted be able to add media files / folders. Similarly add such if the template did not contain any media files in the first place.
Link to documentations
Please select:
Documentation link for docs.joomla.org:
No documentation changes for docs.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed