Automatically Generated Form Pages

From IHRIS Wiki
Revision as of 08:43, 15 March 2013 by Litlfred (talk | contribs) (Created page with "Starting with the 4.1.6 release of iHRIS you will now have the ability to generate pages to edit and view forms entirely in magic data, avoiding the need to create or edit .html ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Starting with the 4.1.6 release of iHRIS you will now have the ability to generate pages to edit and view forms entirely in magic data, avoiding the need to create or edit .html files as well as .php files.

Below we present the types of pages made available and the magic data options need to configure them. This magic data should live under /I2CE/page/$pageName or /modules/$moduleName/page/$pageName.


I2CE_PageFormAuto

This is the simplest page used to edit a single form which is not a child form of another form. The magic data used to define this page is as follows:

  • class: required scalar node with value 'I2CE_PageFormAuto/
  • style: optional scalar node. See page styles for more information. Recommended value is 'shell'.
  • args: required parent node
    • primary_form: required scalar node. The name of the form to edit
    • title: Required scalar node. The page title.
    • auto_template:required parent node
      • disabled. Optional scalar node. If set and evaluates to true, then we do not use the auto generation to display this page. Instead we would fall back to using .html template methods.
      • task: Optional scalar node. A task the user must have in order to edit this form.
      • view_link: Optional scalar node. The link to view this form once the form has been successfully saved. If not set, it will default to 'view_$form.html?id=' where $form is as in primary_form.
      • display_order: optional scalar node. It should be a comma separated list of field names and is used to specify the order in which the fields are displayed. Example would be 'firstname,surname,nationality'
      • display_name: Optional scalar node. Defaults to the display name of the form. It is the text put in the black header row of the edit table.
      • title: Optional scalar node. If not set it uses the values of args/title. This is main text displayed at the top of the page's content.
        • fields:Optional parent node. Keys of children are field names
          • $field: optional parent node.
            • enabled: Optional scalar node. Defaults to 1. If set to 0, this field is not displayed.
            • attributes: Optional parent node. Keys are names of attributes that we want to set for displaying this node
              • showhead: Optional scalar node. Specifies the header to display for this form field. Defaults to 'default'

An minimal example to create a page to edit the person form would look like:

array(
 'class'=>'I2CE_PageFormAuto',
 'style'=>'shell',
 'args'=>Array(
   'primary_form'=>'person',
   'auto_template'=>array(),
   'title'=>'Add/Edit Person'  
 )
)