Under construction - work in progress

Share flexform files

We tried to think about flexform sheets as files to be used for sharing same parameters among more plugins (in same extension or or different extensions).

So, we thought about generating one flexform file for the whole project, with all sheets and fields we needed, and than use that file for importing only needed parts into plugin flexform files.

So, we developed these new commands:

  • importSheet: for importing a complete sheet from a flexform structured file.
  • importSheetFields: for importing only fields from a flexform structured file.

In this way a project flexform file becomes a repository for all needs of a project.

For example, the main flexform file may contain:

  • sheet design
  • sheet configuration
  • sheet graphicOptions
  • sheet imageConfiguration
  • sheet debug

Specific flexform files of plugins may include only what they need. Tipically they will import only the sheets they need specifically.

  • plugin 1
    • importSheet design as design
    • import sheet configuration as configuration
    • make custom sheet
    • import sheet debug as debug
  • plugin 2
    • importSheet design as design
    • import sheet configuration as configuration
    • make custom sheet
    • import sheet debug as debug
  • plugin3
    • importSheet design as design
    • import sheet configuration as coinfiguration
    • make custom sheet
      • importSheetFields from imageConfiguration
      • define other fields
    • import sheet debug as debug

Import commands work on files. Similar cloneSheet and cloneSheetFields work on sheets defined in the same plugin flexform declaration. They will not search for file, but will look inside the allocated memory structure for already defined sheets with that name.

Example for understanding clone commands:

  • plugin A:
    • import sheet1 as s1
    • import sheet2 as s2
    • import sheetStandardPic as SPic
    • clone SPic as Spic2
    • clone SPic as Spic3
    • clone SPic as Spic4
    • create custom sheet specificPic
      • create specific fields
      • clonefields from SPpic

With these commands, any change to the default sheet will automatically be part of importing sheets. 

importSheet command

Command is very simple:

<importSheet>File_to_look_for:sheet_name</importSheet>

importSheet command must be used within the sheet definition which must be filled.

Final name of sheet in structure will be the sheet_name of the importing structure.

TCEForms node may be missing. In such a case title of sheet will be the same of imported sheet

<my_sheet>
  <ROOT>
    <TCEforms>
      <sheetTitle>LLL:EXT:my_ext/flexform/deflang.xml:sheet.my_sheet</sheetTitle>
    </TCEforms>
    <importSheet>EXT:my_ext/flexform/defsheets.xml:baseDesign</importSheet>
  </ROOT>
</my_sheet>

No other fields may be defined within the destination sheet.

importSheetFields command

Also this command is very simple:

<fake_field_name>
  <importSheetFields>File_to_look_for:sheet_name</importSheetFields>
</fake_field_name>

Where:

  • fake_field_name: unique field name which will not be used. Field names will be the same of imported sheet.

Differently from importSheet command, importSheetFields permit to add other fields to destination sheet, as it must be included as a field.

Tipical usage of importSheetFields command:

<myComplexSheet>
<ROOT>
<TCEforms>
<sheetTitle>LLL:EXT:my_ext/flexform/deflangxml:sheet.myComplex</sheetTitle>
</TCEforms>
<type>array</type>
<el>
<enableElement>
<importSheetFields>EXT:my_ext/flexform/defsheets.xml:enableElement</importSheetFields>
</enableElement>
<maxElements>
<importSheetFields>EXT:my_ext_store/flexform/defsheets.xml:maxElements</importSheetFields>
</maxElements>
<defaultConfiguration>
<importSheetFields>EXT:my_ext_store/flexform/defsheets.xml:defaultConfiguration</importSheetFields>
</defaultConfiguration>
<customConfiguration>
<importSheetFields>EXT:my_ext_store/flexform/defsheets.xml:customConfigurationMax</importSheetFields>
</customConfiguration>
<commerceFlags>
<importSheetFields>EXT:my_ext_store/flexform/defsheets.xml:commerceFlags</importSheetFields>
</commerceFlags>
/el>
</ROOT>
</myComplexSheet>

Other fields may be defined within the destination sheet.

cloneSheet command

cloneSheet command is more simple than importSheet.

Given an already defined sheet, cloneSheet may be used for making a clone of the sheet.

Simple command:

<cloneSheet>sheet_to_be_cloned</cloneSheet>

Example:

<image1>
...... definition of sheet, made in whatever way
</image1>

<image2>
<ROOT>
<TCEforms>
<sheetTitle>LLL:EXT:my_ext/flexform/deflang.xml:sheet.image2</sheetTitle>
</TCEforms>
<cloneSheet>image1</cloneSheet>
</ROOT>
</image2>
<image3>
<ROOT>
<TCEforms>
<sheetTitle>LLL:EXT:my_ext/flexform/deflang.xml:sheet.image3</sheetTitle>
</TCEforms>
<cloneSheet>image1</cloneSheet>
</ROOT>
</image3>

As for importSheet command, TCEForms node may be missing. In such a case title of sheet will be the same of imported sheet.

No other fields may be added to destination sheet.

cloneSheetField command

This command is very simple because it clones only one field:

<field_name>
  <cloneSheetField>sheet_name:field_name</cloneSheetField>
</field_name>

Where:

  • field_name: name of field in structure

cloneSheetFields permit to add other fields to destination sheet.

Get importSheetFields as example, with these differences:

  • cloneSheetField works only for one field.
  • name of field is the one defined in destination sheet
  • sheet and field to be cloned must be already defined in destination structure.