I’m creating a module in joomla 2.5, I would like to fetch data from a component to a module configuration like what would happen to this one:
<field
name="catid"
type="category"
extension="com_content"
published=""
label="Category"
description="A content category"/>
I’m aware that this specific sample code from my module XML configuration file would able to fetch a list of categories from the component com_content, but I couldn’t figure out where it’s coming from, how does joomla do this? could I also enable my custom components to do it? if yes how? I’m not sure if this was asked before in this forum but I’m really having a hard time to figure it out if you could give me a link that will teach me how to do it that would be great. 🙂
When you create a component with it’s various
models, you can create customformsfor them as you’re probably aware. This lets Joomla! do a lot of the backend form work for you – all you have to do is define the contents/structure for the form in a XML file.Of course, Joomla! can’t know about every data type so forms need to be extensible. To this end Joomla! provides support for custom form field types… these are defined alongside the
formsdirectory in your model, in afieldsdirectory.By defining an
extensionandtypevalue you tell Joomla! to use that specific extension’s field type. So for your example field Joomla will look for/administrator/components/com_content/models/fields/cateogry.phpYou can read more about “Adding a new field type” in the tutorial on creating a component.