Hi Harald,
Yes, please complete the documentation.
While using jDiction with Event Booking, I had some problems trying to find the correct values for each tag and parameter.
So, I will try my best to add something to the useful information already posted by pagchen.
A
jdiction.xml file should be created inside
administrator/components/com_my_component/.
<?xml version="1.0" encoding="utf-8"?>
<jdiction>
<component>com_my_component</component>
<sections>
<section>
<tables>
<table>
<name>#__db_table</name>
<key>db_table_key</key>
<class>MyComponentTable</class>
<file>my_component.php</file>
<cache fullfetch="0" />
<exportfilter/>
</table>
</tables>
<views>
<view name="edit_view" list="list_view" layout="edit_layout" default="true">
<form import="my_component_form.xml">
<fieldset name="main" label="COM_JDICTION_TRANSLATION_FIELDSET_MAIN">
<field name="a_field" />
<field name="another_field" />
</fieldset>
<fields name="extra_fields">
<fieldset name="extra" label="ANOTHER_TRANSLATION_STRING">
<field name="an_extra_field" />
</fieldset>
</fields>
</form>
</view>
</views>
</section>
</sections>
</jdiction>
<tables> tag
Locate the model file, such as
administrator/components/com_my_component/tables/my_component.php.
The
<table><file> tag should contain the name of this file and in its content we can also find the values for the tags:
- <table><class>, within the code "class MyComponentTable extends JTable";
- <table><name>, within the code "parent::__construct('#__db_table', 'db_table_key', $db);";
- <table><key>, within the code "parent::__construct('#__db_table', 'db_table_key', $db);".
As far I understood,
<table><cache> should have the attribute fullfetch equal to
0 unless we are sure that all the table records are always being fetched by Joomla. Don't know if this tag is mandatory.
The tag
<table><exportfilter> seems to be optional and allows you to filter records through an SQL query when exporting the table, right?
<views> tag
In you administrator's panel visit the component and get the view/task and layout values of the URL of the listing and editing pages.
The
<view> tag should have the following attributes:
- name, value of the view/task parameter in the editing URL:
"mysite/administrator/index.php?option=my_component&view=edit_view" or
"mysite/administrator/index.php?option=my_component&task=edit_view.edit_layout"; - list, value of the view/task parameter in the listing URL:
"mysite/administrator/index.php?option=my_component&view=list_view" or
"mysite/administrator/index.php?option=my_component&task=list_view.list_layout"; - layout, value of the layout parameter in the editing URL:
"mysite/administrator/index.php?option=my_component&task=edit_view.edit_layout" or
"mysite/administrator/index.php?option=my_component&task=edit_view&layout=edit_layout"
(if the layout parameter is not defined, the value "default" should be used); - default, when equal to true it should allow translations on the default component page (without any view/task parameter defined, such as "mysite/administrator/index.php?option=my_component), seems to be useful only when the default task is not the editing or listing because for these it would be enough to specify as "default" its attribute (name or list, respectively).
The attribute
import of the tag
<view><form> accepts XML files (separated by commas) that define forms created using JForm in the
administrator/components/com_my_component/models/forms/ folder. When importing these form definitions, we don't have to specify each attribute of the
field tags beyond the
name attribute, unless we want to change attribute values or specify additional attributes.
Regarding the
fieldset,
fields and
field tags, these should follow what is described in Joomla! Documentation:
http://docs.joomla.org/XML_JForm_form_definitions Still, there are some aspects worth mentioning:
- fieldset tag must have a name attribute and, if a XML form definition file is imported, its value or the value of an additional attribute named reffield should be the same as the one set in the file;
- field tag can have an alias auto-generated from another field by setting the following attributes and values: type="jdalias" and field="source_field_name" (usually source_field_name is "title");
- export of a particular field can be disabled if its attribute export is equal to "false";
- field tag can accept a pair of attributes for holding multiple table columns: the multifield attribute holds the column names (separated by commas) and the seperator attribute defines what separates each column value inside the field; for now, this feature seems to only work with the Joomla content table;
- fields tag can be used for handling multiple fields stored as a JSON format string in a single table column.
Please review and correct this information, thanks.