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::...
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\...
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, ...
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.
. . .
BaseDatabaseModel::addIncludePath(JPATH_SITE . '/components/com_mycomponent/models');
$this->msgsModel = ...
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 ...
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 ...
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:
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/...
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 ...
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 ...
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(...
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.
* Check if the plugin you looking for exists, then add the form he hold
* string $type The plugin type, ...
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/...
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 ...
Did you have a look at the Joomla code itself on Github too?
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 ...