User tests: Successful: Unsuccessful:
With the move to namespaces, we didn't touch the location of the component template files, eg. default.php. They are still in a folder like /components/com_content/views/article/tmpl. This location was valid when we had the view.html.php in the folder above. Now the class is in a different folder. So I think the template files should be moved to a location where it makes more sense and is inline with the rest of the core like modules or plugins.
This pr moves the template files to a tmpl folder within the component root folder below the view name. So /components/com_content/views/article/tmpl/default.php becomes /components/com_content/tmpl/article/default.php.
The menu manager was adopted to support that new folder scheme as well as the view.
This pr was inspired by #15221 and is fully BC as all the other views should render as before. If this pr get accepted, we need to move all the template files of all the namespaced components.
All should work as before. Also the template overrides should work.
Nothing is broken all should work.
This new location needs to be documented.
Status | New | ⇒ | Pending |
Category | ⇒ | Administration com_content com_menus Front End Libraries |
Nope, overrides are the same.
It would need to know where to look to find the overrides though.
I'v just tested it and overrides do work as before.
Yes
It would need to know where to look to find the overrides though.
how does it know where to look if the files have moved
@brianteeman everything happens here:
https://github.com/joomla/joomla-cms/blob/staging/administrator/components/com_templates/models/template.php#L737-L786
So yes it should work as is
Why do you guys don't believe me, it works
This change here https://github.com/joomla/joomla-cms/pull/16218/files#diff-c0ed342062e86e3c3f81da894f9d3e8fR137 adds the tmpl path to the file lookup array.
@laoneo I think Brian is talking about the code which is used to create override in Template Manager. See the block of code which Michael mentioned https://github.com/joomla/joomla-cms/blob/staging/administrator/components/com_templates/models/template.php#L569-L597
Since the layout is now moved to new location, we need to adjust that block of code to allow template manager to find layout from new location
I was thinking I do miss something. Will have a look on that as well.
Yes that's exactly what I meant
Labels |
Added:
?
|
Category | Administration com_content com_menus Front End Libraries | ⇒ | Administration com_content com_menus com_templates Front End Libraries |
Changed the override editor to support the new scheme as well. Updated the test instructions.
I have tested this item
creating overrides is not building the path correctly if the site is installed in a subdirectory as it is including the subdirectory that the site is installed in
I just tested it and it again and I'm working in a subfolder as well, it worked as it should. For a test can you install it from here https://github.com/Digital-Peak/joomla-cms/archive/j4/move-views-tmpl.zip, just to be sure the full patch get applied.
Perhaps somebody else can test it as I don't know what to do more. Guess we will have another look on the code sprint as well. Thanks so far for testing.
I don't see the problem like Brian mentioned, but there are still issues with creating overrider:
For com_users (old layout structure), the override is created at html\view\com_users\views\login . It should be html\com_users\login only
For com_content (new layout structure), the override is created at html\view\com_content\tmpl\article, it should be html\com_content\article only
Forgot to mention I am using Windows. And I installed your branch for testing. So something is still not correct yet
@joomdonation I am on windows too
Also, maybe the code in foreach block of getOverridesList method could be changed to:
foreach ($components as $component)
{
$requireTmplFolder = true;
if (file_exists($componentPath . '/' . $component . '/tmpl/'))
{
$viewPath = \JPath::clean($componentPath . '/' . $component . '/tmpl/');
$requireTmplFolder = false;
}
elseif (file_exists($componentPath . '/' . $component . '/views/'))
{
$viewPath = \JPath::clean($componentPath . '/' . $component . '/views/');
}
elseif (file_exists($componentPath . '/' . $component . '/view/'))
{
$viewPath = \JPath::clean($componentPath . '/' . $component . '/view/');
}
else
{
$viewPath = '';
}
if ($viewPath)
{
$views = \JFolder::folders($viewPath);
foreach ($views as $view)
{
// Only show the view has layout inside it
if (!$requireTmplFolder || file_exists($viewPath . $view . '/tmpl'))
{
$result['components'][$component][] = $this->getOverridesFolder($view, $viewPath);
}
}
}
}
I think it is less change, easier to understand (maybe just me) and save \JFolder::folders call on unnecessary folders.
the override creation works for me now
Good to hear
Status | Pending | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-05-29 09:29:31 |
Closed_By | ⇒ | wilsonge |
Seems good to me. Let's get the rest of the core component converted :)
wont the code in com_templates that creates overrides need changing as well?