Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong media folders created for child template #38725

Open
manuelkling opened this issue Sep 8, 2022 · 3 comments
Open

Wrong media folders created for child template #38725

manuelkling opened this issue Sep 8, 2022 · 3 comments

Comments

@manuelkling
Copy link

manuelkling commented Sep 8, 2022

Steps to reproduce the issue

Create a child template.

Expected result

It creates the same media folders that the parent is using at media/templates/site/foo and defined in templateDetails.xml.

Actual result

It creates the media folders (css, images, js, scss) and the file folder (html) from cassiopeia, even if i create a child of another template.
If i create a child from cassiopeia it still should not create the html folder in the media path (media/templates/site/cassiopeia) but in the template path (templates/cassiopeia).

System information

Joomla 4.2.2.
PHP 8.0.22

@manuelkling
Copy link
Author

manuelkling commented Sep 9, 2022

The folder creation is static in the TemplateModel and not looking for the parents templateDetails.xml settings:

// Media folder
$media = $xml->addChild('media');
$media->addAttribute('folder', 'media');
$media->addAttribute('destination', 'templates/' . ($template->client_id === 0 ? 'site/' : 'administrator/') . $template->element . '_' . $newName);
$media->addChild('folder', 'css');
$media->addChild('folder', 'js');
$media->addChild('folder', 'images');
$media->addChild('folder', 'html');
$media->addChild('folder', 'scss');

// Create an empty media folder structure
if (
!Folder::create($toPath . '/media')
|| !Folder::create($toPath . '/media/css')
|| !Folder::create($toPath . '/media/js')
|| !Folder::create($toPath . '/media/images')
|| !Folder::create($toPath . '/media/html/tinymce')
|| !Folder::create($toPath . '/media/scss')
) {

@brianteeman
Copy link
Contributor

Please test #38986

@manuelkling
Copy link
Author

If i create a child from cassiopeia it still should not create the html folder in the media path (media/templates/site/cassiopeia) but in the template path (templates/cassiopeia).

This part is fixed, thanks.

It creates the media folders (css, images, js, scss) and the file folder (html) from cassiopeia, even if i create a child of another template.

It is not looking for the original folders if i create a child from another template tho.

@Hackwar Hackwar added the bug label Feb 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants