class Form

Base class for forms, loads default configuration options, checks allowed values etc.

Properties

string $name Form name
int $index Arbitrary index, doesn't affect class' behavior
array $fields Form fields (paths), filled by {@link readFormPaths()}, indexed by field name
array $default Stores default values for some fields (eg. pmadb tables)

Methods

__construct(string $formName, array $form, ConfigFile $cf, int $index = null)

Constructor, reads default config values

string|null
getOptionType(string $optionName)

Returns type of given option

array
getOptionValueList(string $optionPath)

Returns allowed values for select fields

void
readFormPaths(array $form)

Reads form paths to {@link $fields}

void
readTypes()

Reads fields' types to $this->_fieldsTypes

void
loadForm(string $formName, array $form)

Reads form settings and prepares class to work with given subset of config file

Details

at line 65
__construct(string $formName, array $form, ConfigFile $cf, int $index = null)

Constructor, reads default config values

Parameters

string $formName Form name
array $form Form data
ConfigFile $cf Config file instance
int $index arbitrary index, stored in Form::$index

at line 83
string|null getOptionType(string $optionName)

Returns type of given option

Parameters

string $optionName path or field name

Return Value

string|null one of: boolean, integer, double, string, select, array

at line 104
array getOptionValueList(string $optionPath)

Returns allowed values for select fields

Parameters

string $optionPath Option path

Return Value

array

at line 179
protected void readFormPaths(array $form)

Reads form paths to {@link $fields}

Parameters

array $form Form

Return Value

void

at line 204
protected void readTypes()

Reads fields' types to $this->_fieldsTypes

Return Value

void

at line 231
void loadForm(string $formName, array $form)

Reads form settings and prepares class to work with given subset of config file

Parameters

string $formName Form name
array $form Form

Return Value

void