0
votes

A contractor has built a Joomla 1.5 extension for us, and I'm confused by an architectural choice he made. I'm not a hardcore Joomla user, so I don't know if the way it was built is normal.

When I install the extension, I get two separate parts:

  • A component portion that has system-wide settings on it (for example, a setting that turns on and off features for the site as a whole)
  • A plugin portion that has content-related settings on it (for example, settings that specify which content categories and articles to apply the features to)

I'm not wild about the functionality being split into two sections like this: you have to enable both the component and the plugin to get it to work, and you have to remember which section a particular setting is found on when you want to change it. I prefer the idea of having everything in just one plugin.

Questions for those wiser and more experienced than I:

  1. Is it normal for an extension to be composed of both a component and a plugin?
  2. Is it technically feasible to combine any particular functionality into a single component or a single plugin?
  3. If the answer to #2 is yes, is it generally advisable to combine the functionality?

I hope this question isn't too vague. Thanks for readin' it.

2

2 Answers

2
votes
  1. It is not always the case that you need a component and a plugin but there a a lot of valid reasons to do it.
  2. No, there are many cases where this is not possible

Components and plugins in Joomla have a very different range: components in the frontent just react if they are directly called (e.g. /index.php?option=com_your_component) but plugins (especially content plugings) are effective all over the page. You often need both of them e.g. if you have a component for displaying pictures: your component can show you a whole page with all galleries and your plugin enables you to include pictures or slideshows in normal articles.

2
votes

The answer is it depends. It's not unusual for an extension to have a component, module(s), and plugin(s) or any combination of the 3. It is first important to understand the difference in the extensions to determine which you will need to use.

  1. Plugin - this is code that is triggered by various events that happen during the execution of the Joomla framework. There are several types of events, and several different events within those types. When the plugin is triggered, it will execute what ever code you have in it. This can be anything from inserting new content, changing the default behavior or Joomla or other extension, or just about anything else you can think of. More info on plugins and events - http://docs.joomla.org/Plugin

  2. Module - a module very simply is used to display content in a module position. The content can be generated by the module itself or it can be pulled from a component. Modules are everything else on the page outside the main content area where the component is displayed.

  3. Components - components are a little more complex. They are usually used to create a whole new type of content and have many instances of that content - classified ads, inventory listings, products, etc. Components very often add additional functionality that is related to the new content types like shipping calculation, payment methods, user content entry etc.

Once you understand how each of these is intended to interact with Joomla, you can determine if your extension needs a component and a plugin.