I created a template override for Articles Newsflash module and renamed the default layout to fit my purpose. I refreshed the module settings in the backend and my custom layout does not appear in the layout list. So, I went to ModuleHelper::getLayoutPath() and tried to var_dump() $tPath variable on line# 307 so I would know if my template override path is being checked. Then I get this error:
Class 'Joomla\CMS\Helper\JFactory' not found
On line#294:
$template = \JFactory::getApplication()->getTemplate();
Custom layout on template override for module should appear in the Layout list.
Error, see above.
Database Type | mysql
Database Version | 5.5.56-MariaDB
Database Collation | utf8_general_ci
Database Connection Collation | utf8mb4_general_ci
PHP Version | 7.0.27
Web Server | nginx/1.12.2
WebServer to PHP Interface | fpm-fcgi
Joomla! Version | Joomla! 3.8.6 Stable [ Amani ] 13-March-2018 14:00 GMT
Joomla! Platform Version | Joomla Platform 13.1.0 Stable [ Curiosity ] 24-Apr-2013 00:00 GMT
User Agent | Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.186 Safari/537.36
Labels |
Added:
?
|
@mbabker Thanks for replying so soon. When I developed my template, Joomla was version 3.5, I am using the same method of debugging until 3.7.x. Now on 3.8, if you don't mind, how or what is the proper way of bootstrapping the CMS so I don't get an error with class mapping? Can you point me to a documentation please. I am using PhPStorm and I don't remember having a special setting with my IDE environment to have a proper class mapping with Joomla.
Anyways, thanks for pointing me to the form field.
For IDEs since 3.8 you should run this stub generator script to generate a list of class stubs for the renamed classes. If PHP is actually being executed somehow, the various scripts in the CLI directory have a minimalistic bootstrap to ensure everything is usable.
Status | New | ⇒ | Discussion |
Category | ⇒ | Code style |
Status | Discussion | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2018-03-21 14:42:14 |
Closed_By | ⇒ | joomla-cms-bot |
Closed_Date | 2018-03-21 14:42:14 | ⇒ | 2018-03-21 14:42:16 |
Closed_By | joomla-cms-bot | ⇒ | Quy |
Set to "closed" on behalf of @Quy by The JTracker Application at issues.joomla.org/joomla-cms/19927
You would only get this error if the CMS was not bootstrapped correctly. The CMS bootstrap loads a class mapping layer for all the classes that were namespaced at 3.8. "JFactory" doesn't exist as a class anymore, but is aliased in that mapping layer, so calls to it will work correctly.
For your issue, the layout not showing up in the backend select lists would mean it's not being found by the form field. The method you're debugging is only involved in the rendering process.