Where to Place Custom Classes in Joomla (Component, Plugin, Module?) - joomla

I am new to Joomla (a seasoned WP dev) and I have just barely managed to wrap my head around the components and the plugins.
The thing is, that I want to include a shared component (a class), that should be callable from both the component and the plugin.
Any ideas? A library maybe? Can I bundle a library in a Joomla installer Package in this case?

If you create a lib_yourlib.xml file in the root directory and specify :
<extension type="library">
<files folder="yourlib">
it should be installable like any package, and it will be copied in libraries/yourlib after installation.

Related

Import existing modules in the VS code plugin extension

We're developing a VS Code extensions web plugin using Typescript. We already have a company provided component, which is downloaded in the node_modules folder. But when I'm referring those modules, the application does not start:
How can I use those components in my plugin extension.
From the web view standpoint, there's no Node.js, no VS Code, node_modules or anything you have in the extension you are writing. The content of the web view must be fully self contained. You have to use a bundler (like webpack) to create JS bundles of your application you want to show in the web view, which includes all the source code of the referenced 3rd party libraries.

PhpStorm - undefined class in Joomla project

I want to use PhpStorm on Joomla project but I can not use "Go to Class Declaration" (Ctrl+B) on main Joomla classes. For example JFactory::getApplication().
But with my own functions in custom plugin that option works great.
What it can be wrong there?
I have Joomla support plugin.
I have docblock plugin.
I tried invalidate caches.
Legacy code
You only need that to work on legacy code. With the introduction of namespaces, most classnames have changed.
JFactory is a now non-existent class - it has been removed from the core. For compatibility's sake, a class alias is provided at runtime, so PHP can find the new class instead. PhpStorm (and other IDEs) don't know about those aliases (there are a lot more of them).
Stubbing
To solve the problem, Joomla provides a stub, that tells the IDE where to find the new class. Just run
$ php build/stubGenerator.php
This will generate a stubs.php file in your project's root directory with the proper information.
New code
For new code, don't use those old classnames - use their new name instead. The new classnames make it much more likely, that your new code will run on Joomla! 4.0.

joomla 3.0 extension manager not finding update of module

I developed a module that can be updated in Joomla 2.5 Extension Manager.
I can't find information anywhere that indicates that something needs to be different in order to work properly in Joomla 3.0
I don't intend to advertise this module by providing the link to it, I'm just trying to find help to fix this problem.
Here is the page where you can download it:
http://code.google.com/p/mod-random-article/downloads/list
If you install v1.1 on Joomla 2.5, the Extension Manager will find the new update v1.2.
If you install it on Joomla 3.0, the Extension Manager won't find the new version.
Can anyone help?
Thanks
I found the solution for my problem.
This looks so easy.. I don't know how I couldn't find this earlier.
I had to add another tag to the manifest file on the update server targeting Joomla 3.0, like this:
<updates>
...
<update>
...
<targetplatform name="joomla" version="3.0"/>
...
</update>
</updates>
I had renamed everything to the respective plugin name but still joomla wasn't finding the new copied and modified plugin that I had created.
Finally I found out that the plugin attribute of the XML object, needs to be the same name that of the plugin. So lets say that the new plugin name is xxyyzz, As shown below with the other respective changes, the plugin attribute should also be updated.
<files>
<filename plugin="xxyyzz">xxyyzz.php</filename>
</files>

Joomla one install file that installs component, modules and plugins

I'm looking for a way to setup the XML install file for my component and for it to also install the plugins and modules that go along with it all in a single installation. Has anyone done this before, how can this be achieved?
Many thanks
Try checking out http://www.joomlacontenteditor.net/ the basic editor installs the component and the affiliated plugin. Simply, it used the xml put the files in the correct places and uses an install.php script to finish. It does a lot of detailed things in some of the steps that you can ignore like all the component plugins etc.

Differences between an extension and a module?

Both extend the features and functionality of Magento, but what are the differences between them?
I've finally found the answer.
Extensions are simply packed modules. In other words, you extend the features and functionality of Magento by writing a module. Then you have a choice to leave it as it is or pack it up (System > Magento Connect > Package Extensions). An extension (a packed module) is then published on Magento Connect.
The Main difference between extension and module is that, when you create any extension it can be for community as well and can be used by others installing simple package as it is. And module are something that is part of core magento it can be for your own purpose and for others too. Not necessarily you will create package of it to have it work .
In Most cases solely you will use them
The main difference is that you can realize the main functional with an extension or a component. And with a module you realize an additional functional. Extensions include modules, or modules extend components.

Resources