Logged in as

Morf configuration

The default configuration for all Morf instances is set within the configuration file /modules/morf/config/morf.php. This default configuration can be overridden by passing an associative array as the first argument to a new Morf object.

This document contains a detailed list of settings and available values.

$config['autosubmit']

If set, this setting automatically provides an element to submit the form. Either an input submit element or a button element are available. Morf will automatically append the submit interface as the last element of the form.

Values

  • (boolean) FALSE turns off this the autosubmit feature
  • (array) Associative array containing keys; value; config
    • value, (string) the value to place on the element
    • config, (array) Morf_Element type descriptor

Example

$config['autosubmit']    = array
(
    'value'      => 'Submit',
    'config'     => array('type' => 'submit')
);

$config['post']

If set to TRUE Morf will automatically set the element value to the value of a $_POST key if available. This will override any value you set before rendering the element.

Values

  • (boolean) FALSE uses the value set manually
  • (boolean) TRUE uses the post value if available

$config['errors']

Controls the rendering of error messages for each element and i18n file to use for messages.

Values

  • (array) Two element associative array containing
    • class, (string) the class name to apply to the offending input
    • file, (string) the filename of the i18n file with the translations for this morf form (see i18n)
    • file, (void) NULL

Example

$config['errors']        = array
(
    'class'          => 'inputError',             // The class to assign to the offending input
    'file'           => 'morfLoginErrors',        // The i18n validation file with the correct error statement
);

$config['elements']

Controls the rendering of all the standard elements supported by Morf. The config setting consists of a multi-dimensional array containing HTML element keys, the Morf element type and the default view used to render the element.

All elements have an associated view that can be redefined at any stage before rendering. This provides the developer with full control over how each element is rendered.

Also available in: HTML TXT