-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Fix parseXMLTemplateFile invoke in TemplateModel.php (Create child template button is not displayed) #41313
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
Conversation
Fix parseXMLTemplateFile with $template->name param. Change to $template->element due to $template->name might be a language constant
Update TemplateModel.php
|
Thank you for our PR. Could you please add some more information? Testing instructions? If this can be tested successfully, your second PR for J5 #41314 is not necessary as this one will be upmerged automatically. |
|
A useful title instead of „4.4-dev“ would also be good. |
|
This looks like it might be correct but you must provide a way for someone to test this. ie If you do this then it fails but if you apply this change then it no longer fails |
|
Ping @dgrammatiko |
The templateDetails.xml is special in this regard. The name is the same as the element and the translated string is constructed out of it. I cannot point you to some code where this is obvious because I'm on my phone. Also changing it to element is fine so 🤷♂️ |
Yes, I have already discovered this in the process of researching the code for writing testing instructions. Also, in the process of searching, I found out that this affects the functionality of the create child template button |
|
A simple example. YOOtheme Template (YOOtheme Pro). Template itself is already designed for child themes and not using them will not cause problem. However, the developer made 2 mistakes in the xml file that prevent the creation of a child template, even if you add
I don't have time for PR to the core right now. So I asked Sergey to make it. But I didn't give him all the information, for which I apologize. |
|
Ok, couple of notes here why the
Anyways, the PR is fine |
|
What happens when a template doesn't have the element tag? |
The name should be the same as the folder of the template (kinda the default option). You can check all the Joomla default templates 2.5/3.x/4.x FWIW the PR I mentioned above from Hannes should be done against 4.4, merged and all the docs for the manifests should point out that the element tag is required. Consistency could help iron out weird cryptic things that nobody actually knows in all their details... |
|
To be on the safe side, I would go with the element tag and when it doesn't exist, do a fallback to the name tag. We can also add a deprecate message when an element tag doesn't exist. How it is now, it looks like a rather unexpected (but valid) code change where we need a transition time. |
|
@laoneo some time ago I fixed the modules that were on the new format (namespaces) #33182 but when people started massively rewriting the rest to the new format they used a hack instead of the element tag. The hack is not documented so devs should copy code, verbatim, that they don't understand and they can't find any docs for it. Not great. Back to this PR, The test should be easy create a template with a name=Testable and an element=test (the template should be installed in the test folder) and check that the template manager still works as expected. |
|
For the test it is ok, but to keep backwards compatibility it looks for me that the code should use the element tag and then fallback to the name tag. To help extension devs to do the transition to the element tag, a deprecate message should be thrown till we do the full move. |
What should be added in this case? As far as I understand, at this point in the execution of the application, we are talking only about specifying the correct path to the file, since a few lines before that there is a request to the database, from where we get both |
|
Sorry for the noise, just realized that the record is coming from the database and there is the element attribute always set even when it doesn't exist in the manifest file. Then I'm happy with the changes here. But I would like to get some tests before I merge it. |
|
I have tested this item ✅ successfully on 316ef2c This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/41313. |
|
I have tested this item ✅ successfully on 316ef2c This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/41313. |
|
RTC This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/41313. |
|
Thanks! |








Fix
parseXMLTemplateFilewith$template->nameparam. Change to$template->elementdue to$template->namemight be a language constant