jDiction Forum

Overview => Extension plugins => Topic started by: Harald Leithner on August 01, 2014, 04:16:48 pm

Title: XML Specification
Post by: Harald Leithner on August 01, 2014, 04:16:48 pm
This is the documentation for the xml File used by jDiction to support 3rd party extensions.

Thx to pagchen and pipedream for creating most part of this post.


A jdiction.xml file should be created inside administrator/components/com_<COMPONENT>/.

Code: [Select]
<?xml version="1.0" encoding="utf-8"?>
<jdiction>
  <component>com_<COMPONENT></component>
  <sections>
    <section>
      <tables>
        <table>
          <name>#__db_table</name>
          <key>db_table_key</key>
          <class><COMPONENT>Table</class>
          <file><COMPONENT>.php</file>
          <cache fullfetch="0" />
          <exportfilter/>
        </table>
      </tables>
      <views>
        <view name="edit_view" list="list_view" layout="edit_layout" default="true">
          <form import="<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_<COMPONENT>/tables/<TABLE>.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><cache> should have the attribute fullfetch equal to 0 unless we are sure that all the table records are always being fetched by Joomla.

The tag <table><exportfilter> is optional and allows you to filter records through an SQL query when exporting the table.

<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:
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_<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
NOTE: there are some things missing in Joomla documentation, such as:
- in order to avoid that HTML from an Editor form field type is filtered, it is necessary to add the attribute filter="JComponentHelper::filterText"

Still, there are some aspects worth mentioning: