0

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. :)

j0k
  • 22,600
  • 28
  • 79
  • 90
Christopher Pelayo
  • 792
  • 11
  • 30

1 Answers1

0

When you create a component with it's various models, you can create custom forms for 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 forms directory in your model, in a fields directory.

By defining an extension and type value 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.php

You can read more about "Adding a new field type" in the tutorial on creating a component.

Craig
  • 9,335
  • 2
  • 34
  • 38
  • Thanks cppl I'll do check on it first :) – Christopher Pelayo Jul 08 '12 at 01:24
  • Thanks for the resource it really helped me alot in dissecting the existing component that I'm currently using the name of the component is Sobipro (free of use but need to pay for the documentation support) and the developers of this component did not follow the standard joomla MVC definitely the component provides amazing features but the CODES REALLY SUCKS! They were able to provide a paid documentation support for the settings but no CODE DOCUMENTATION! LOL – Christopher Pelayo Jul 08 '12 at 02:37