Installed 4.13.RC1 over a 4.1.2 Install, received a notice of 3 overrides to check. When selecting my template I receive the following warning
No Warning
Warning: Undefined property: Joomla\CMS\Object\CMSObject::$inheritable \administrator\components\com_templates\src\Model\TemplateModel.php on line 2221
PHP 8.0.13
Database Version | 10.4.22-MariaDB
utf8mb4_general_ci
Frontend Template - Yo0theme
XAMMP
Labels |
Added:
No Code Attached Yet
|
Is this new? Not in 4.1.2?
Installed over, how?
Or did you mean upgraded
I think the problem is that the Yotheme template doesn't provide the inheritable property in the template details XML file, like Cassiopeia has it here: https://docs.google.com/spreadsheets/d/1VY77oqekLMzKExyqlJ3q_H692bRl3ik8_-0J8aP0ZV0/edit#gid=0
To handle this, line 2221 of the template model should indeed be changed like @Stevec4 suggested above.
@dgrammatiko Do you agree? Or do we require the inheritable property in the template details XML files in 4.1?
@Stevec4 Do you want to make a pull request? Testing instructions would be more or less the same as here: #36250 .
@dgrammatiko Do you agree? Or do we require the inheritable property in the template details XML files in 4.1?
This is weird as the installer should always inject the inheritable and parent at the installation process:
joomla-cms/libraries/src/Installer/Adapter/TemplateAdapter.php
Lines 342 to 343 in 279c240
And when we did the upgrade from 4.0.x to 4.1 we also injected the values (not inheritable no parent) to all templates, iirc. So this is weird...
To clarify:
It was an upgrade using the full RC1 zip file from github, not via Joomla update,
This warning was not present in my Joomla 4.1.2
Steve
@Stevec4 actually your solution is fine, the code as written right now expects that the inheritable
attribute exists in the XML, which is falsy for legacy templates. Maybe if (!isset($template->xmldata->inheritable) || !$template->xmldata->inheritable)
to get the falsy part for templates with an inheritable
attribute with a 0
value
@dgrammatiko if (!isset($template->xmldata->inheritable) || !$template->xmldata->inheritable)
... wouldn't that just be easier with if (empty($template->xmldata->inheritable))
?
@richard67 that would work as well
@richard67 I have never done a PR but I am happy to if you like. I tried both changes the one Dimitris suggested and yours above and both solve the issue.
Steve
@richard67 I have never done a PR but I am happy to if you like.
@Stevec4 Go for it. If you struggle with Git or GitHub we can advise.
I will give it a go now @richard67
@richard67 feel free correct the PR if I have messed it up.
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2022-05-04 15:01:11 |
Closed_By | ⇒ | richard67 |
I changed the line of code to, and the error is removed.
if (!isset($template->xmldata->inheritable))