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 condition in componentlayout field, custom layout ignored #9464

Closed
Marc-oO opened this issue Mar 18, 2016 · 4 comments
Closed

Wrong condition in componentlayout field, custom layout ignored #9464

Marc-oO opened this issue Mar 18, 2016 · 4 comments

Comments

@Marc-oO
Copy link
Contributor

Marc-oO commented Mar 18, 2016

Steps to reproduce the issue

Create a custom layout in your frontend template :
/templates/mytemplate/html/com_content/category/myblog.xml (copy of blog.xml)
/templates/mytemplate/html/com_content/category/myblog.php

Expected result

Create a new content category (Goto : /administrator/index.php?option=com_categories&view=category&layout=edit&extension=com_content)

Goto tabs "parameters" > "Layout" > select my custom layout "myblog" in the list

screen shot 2016-03-18 at 04 59 36

Actual result

my custom layout "myblog" is not in the list :(
see screenshot

System information (as much as possible)

All joomla3 versions concerned

Additional comments

Solution :
In ./libraries/legacy/form/field/componentlayout.php +195
replace
|| (in_array(basename($file, '.php'), $xml_files)))
by
&& (!in_array(basename($file, '.php'), $xml_files)))

@wilsonge
Copy link
Contributor

This is intended. Basically if you choose to supply an article XML field then its designed to be used in the menu manager as an alternative menu item type. If you wish to choose it in article menu then you must only supply the php file WITHOUT an xml file.

I'm not sure why this was made the intended behaviour but it would be a massive b/c break to change at this point in Joomla 3 - sorry :(

@Marc-oO
Copy link
Contributor Author

Marc-oO commented Mar 20, 2016

Forgot my previous message, just look at the screenshot, if your template embeds custom com_content/category layout(s), WHY thoses custom layouts arent listed in the dropdown list ?
68747470733a2f2f6973737565732e6a6f6f6d6c612e6f72672f75706c6f6164732f312f64396130626662623033373835363230616430326566336666623961643962652e706e67

List visible here : mysite.com/administrator/index.php?option=com_categories&view=category&layout=edit&extension=com_content Parameters tab.

@wilsonge
Copy link
Contributor

Because Component Layouts (with a PHP File) and Menu Types (for Menu Manager with an XML file) are treated differently by the CMS.

If you remove the XML file then you can use it in Articles and Categories but not in the Menu Manager.

@Marc-oO
Copy link
Contributor Author

Marc-oO commented Mar 20, 2016

Ok, so there is an other bug.. maybe not part of the "component layout" field.. If you create a menu Item (with a custom Layout com_content/category) in order to display articles of multiple categories AND subcategories, the first page will have the good layout (the custom) but if you go deeper, in a subcategory, the layout will not be the good one. Do you need steps to reproduce the issue ?

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

3 participants