Solar_Form::load()

public void Solar_Form::load ( string|object $obj )

Loads form attributes and elements from an external source.

Parameters

  • (string|object) $obj: If a string, it is treated as a class name to instantiate with Solar::factory(); if an object, it is used as-is. Either way, the fetch() method of the object will be called to populate this form (via $this->attribs property and the $this->setElements() method).

Returns

  • (void)

Description

Loads form attributes and elements from an external source.

You can pass an arbitrary number of parameters to this method; all params after the first will be passed as arguments to the fetch() method of the loader class.

The loader class itself must have at least one method, fetch(), that returns an associative array with keys 'attribs' and 'elements' which contain, respectively, values for $this->attribs and $this->setElements().

<?php
$form = Solar::factory('Solar_Form');
$form->load('Solar_Form_Load_Xml', '/path/to/form.xml');


Local