4

JControllerLegacy::getInstance() caches the first controller instance so you're actually getting an instance of your component's controller rather than Content controller. You can skip the controller and get the model directly instead: JModelLegacy::addIncludePath(JPATH_SITE . '/components/com_content/models', 'ContentModel'); $model = JModelLegacy::...


3

Any component that is an instance of Joomla\CMS\Extension\LegacyComponent. This includes: J3 style components that do not have services/provider.php file returning a service provider. J4 components that do not provide an implementation of Joomla\CMS\Extension\ComponentInterface. J4 components that provide an instance of Joomla\CMS\Extension\...


3

It would help if you told us what the extension is, so we could be specific. But failing that, try this: Presuming that it's a site component you're dealing with (of course there are different types of extensions), you'll find a component folder named com_componentname under [SITE_ROOT]/administrator/components. In that folder, you'll find an XML file, ...


2

My approach would be to update your code to move away from JModelLegacy and by placing the addIncludePath in the subcontroller using the following lines. mycomponent/controller/messages.php Use Joomla\CMS\MVC\Model\BaseDatabaseModel; . . . BaseDatabaseModel::addIncludePath(JPATH_SITE . '/components/com_mycomponent/models'); $this->msgsModel = ...


2

save() calls store(). Store() works like this: If a primary key value is set the row with that primary key value will be updated with the instance property values. If no primary key value is set a new row will be inserted into the database with the properties from the Table instance. Please check, if the primary key of the database table is set in your $data ...


2

It is doubtful it may work; and even if it did, you risk other issues. Components often use constants and loaders that would not work outside the component itself, such as JPATH_COMPONENT. I see the main risk in the assets, which will be created by Joomla referencing your calling component (the social login component) instead of the called component (Easy ...


2

Components in J4 use a service-based approach which, in theory, should allow any naming convention. Although for that you'd have to write your own factories. But if you want to follow same conventions as Joomla core components, start by declaring a namespace in the component's manifest file. The namespace should be in this form: [Vendor]\Component\[Component ...


2

Some time ago, I invented a snippet system for my component which lives in the /tmpl/ folder. I can reuse those snippets and users can still override them using plain old template overrides. Joomla has something which is similar/better: Layouts. I would send you in this direction. Here are some examples in the Joomla repository: https://github.com/joomla/...


2

Joomla Layouts can be used to share common parts of a View between multiple files. A search and some reading on Layouts will mostly be around how to override the Layouts and from a modifying the template point of view but if you look through some of the core components in the /layout directories you can get an idea of how to use them in the Views of your ...


2

Many years ago I had the same question: "where should I put my own code in Joomla?". It was very frustrating at that time for me too and Joomla has a long learning curve, comparing to WordPress for example. Many of us easily can forget how confusing Joomla can be if someone wants to customize it or understand it. No wonder why WordPress is used ...


2

The solution has been found. My controller contained a __construct() function of this type: class MyviewnameController extends FormController { function __construct( $config = array() ) { $this->view_list = 'list'; parent::__construct( $config ); } } I looked at the com_content component controller and saw that now __construct(...


1

If I got it right, you need first check if that plugin exists. If he does, then add the plugin form folder to the global list of form paths and then load the .xml form file. use Joomla\CMS\Plugin\PluginHelper; use Joomla\CMS\Form\FormHelper; /** * Check if the plugin you looking for exists, then add the form he hold * * string $type The plugin type, ...


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/...


1

There a plenty opportunities for things not to work at the other end, however this is the basics that might get you there. Depending on the component that you want to move you will need to find all the pieces of the component and they should be in /administrator/components/com_some-name/ for the back end and /components/com_some-name/ for the front end ...


1

Did you have a look at the Joomla code itself on Github too? https://github.com/joomla/joomla-cms/tree/4.0-dev When I take a look at the php files in the tmpl directories of components and modules I see the following setup for classNames. modules => mod-modulenmame components => com-componentname For instance com_contact. The className for a single ...


Only top voted, non community-wiki answers of a minimum length are eligible