We changed our privacy policy. Read more.

New answers tagged

0

@Eoin's snippet works perfectly other than it should be JFactory. // Load the namespacing for Factory (the new way instead of JFactory) use Joomla\CMS\Factory; // Load the module position <?php echo JFactory::getApplication()->getDocument()->loadRenderer('modules')->render("logo"); ?>


1

Components aren't really meant to be rendered more than once per request. Your best bet would be to make separate requests. Wrapper component and module can be used to display the page using an iframe. Or you can retrieve the page in PHP using HTTP library. There is Components Anywhere plugin which uses this method https://extensions.joomla.org/extension/...


3

I try to give just a short answer on this. We cannot say that there is an “equivalent” of your code snippet in Joomla 4 since Joomla has been handling errors with using core PHP Exceptions. And your code sample would get error in newer Joomla 3 also. The old JError class were deprecated quite long time ago (at Joomla 3.1). The code editors shows this ...


0

The ideal way is to have dependencies injected into your objects. Event dispatcher is registered with the global service container so you can fetch it when registering your component services in provider.php. However, there isn't a good way to pass it down to MVC elements without a custom MVC factory. Core components don't use anything like that yet. That ...


1

One way is to explicitly specify the class with an inline doc block: /** @var \Path\To\BookModel $model */ $model = $this->getModel('book');


3

Use the fully qualified class name which is Joomla\CMS\Helper\ModuleHelper. To get this information in your IDE, you can run build/stubGenerator.php script via PHP command line. This will generate a stub file of deprecated class aliases and the new classes to use. This is how it looks in VS code:


Top 50 recent answers are included