Support Joomla!
Let's Talk About Fields
User Rating: / 2
PoorBest 
Content Type Management
Written by Ercan Özkaya   

My project is mostly about different kinds of fields that will keep data for content types. So I think mentioning them a bit is not a bad idea.

Fields are the things that will generate HTML code for forms and they will also deal with the columns in database that will hold the actual data. They are very much like Joomla! plugins. This makes adding and even developing fields easier.

They consist of two files:

  • An XML file to hold field name, description and parameters.
  • A PHP file to hold the renderer method for the field.

For each field instance, a row in database is created to store parameters and column data. These parameters make each instance configurable. For example, if the field is required to be filled in forms, there will be a parameter for that in params column.

Next thing to mention is PHP classes for fields. They will be similar to JElement derivatives in Joomla! framework. A renderer method will take the database row and output an HTML field for forms. For example, a simple text field renderer will output something like that:

<input name="text_field" id="text_field" class="inputbox required" value="Value coming from database" />

They may be installed using normal Extension Manager of Joomla! in the future (hopefully in 1.6). But for now, I'll have a seperate installer in my component for installing/uninstalling fields.

First thing in my mind before designing this system was to make fields pluggable to allow third party field types. I think this system will give developers some flexibility to create new field types. But if you think something is wrong with this system and have suggestions, I'm eager to hear them.

 

Show other articles of this author

3 Comments

  1. I have a simple question, I was searching for a way to add a custom field to the article manager. More specifically I want to be able for each new article I add, to specify the volume number of the newspaper in which this article appeared, and there are currently no fields that would allow me to do that. Is the content type project a solution to this issue or is it more related to input forms? Thank you for your reply..
  2. I think the feature to allow 3rd party field types is a very important one. Thank you.
  3. It's a great extension. I'm just thinking - isn't it a bit limiting to allow only one field in a database to store the content of the field? For example, I want to make a field that is a tagging utility. I can store multiple tags in a single string, but this is a bit limiting in terms of search, no? I would prefer to create a many-to-many relationship with some kind of taxonomy in the background. Would I be able to write such an extension to your CTM? I'm currently working on a taxonomy extension (if you are interested, see my joomla taxonomy), and I would like in the end to be able to integrate it with your component via a plugin. Would current plugin architecture of yours allow this?

Add Comment