Chapter 1: Types
What are types?
Well, we just covered, that views are simply the page you want to edit. So types or elements are fields on the page that the user is allowed to edit. You can consider a view or web page made up of different viewable elements or types. Some of these types, you may not want to be editable and be read only. So again this is a decision you must make on what element or type will be editable when it comes to editing your component inline.
Okay, let’s recap, we have, now, mentioned that for a component to support our inline editing framework, that we will have to tell the framework what views are allowed to be editable, and what elements/types on that view are, actually, editable as well.
We will, now, go on with a detailed working example on how to do all of this.
So to start, let's say, we have a component called MyCCK, a simple Content Construction Kit. This component will have a simple item view and a category blog view.
So, the views are:
- Item.
- Category
In this Simple Content Construction Kit, it will have in the item a main article field/type, and in the category blog view, there will be two more types, which will be the category type and the item blog type, for each blog item displayed.
So, the types are:
- Category
- Item
- Blog
To tell the inline editing systems this information, we are going to make a simple package/plugin for Joomla.
So, in the XML install file in this package we will add these elements for the above information:
<extensionName> com_mycck </extensionName>
<!-- allowable views for inline editing //-->
<views>
<view>item</view>
<view>category</view>
</views>
<!-- add context element if context is different to extension Name //-->
<!-- extension types to be used for inline editing //-->
<types>
<type>category</type>
<type>item</type>
<type>blog</type>
</types>
The new XML element called, ‘extensionName’ is needed to tell the system the name of the component to add inline editing support. In this example, it will be called com_mycck.
Don’t worry about where we put these XML elements in our XML install file for now, we will cover that more in detail, in the XML Installation Manifest File section.