static Naos_Form form(
$module,
$formId, [
$requireReceived = false]
)
|
|
This function provides access to the form instances. It implements a singleton pattern on class identifier basis, i.e. only one instance of a form class per class identifier is allowed. The instances are collected in a cache for later access.
Parameters:
|
|
$module: |
|
|
|
$formId: |
|
|
|
$requireReceived: |
|
API Tags:
void __construct(
$module,
$formId
)
|
|
This is the constructor of the form class. It is protected and therefore it is not possible to instantiate the form class directly.
The constructor prepares the form object and loads available values from the available data sources. Later on it applies the form definition, which includes the application of Naos_Form_AttributeTextFilter and the generation of error messages.
Parameters:
API Tags:
| See: | Naos_Form:form |
| Access: | protected |
void addError(
$errorText,
$errorParams,
$item, [
$index = null]
)
|
|
Adds a new eror to an item or to a specific index of an item.
Parameters:
|
|
$errorText: |
|
|
|
$errorParams: |
|
|
|
$item: |
|
|
|
$index: |
|
API Tags:
void applyAdditionalDefinition(
$definitionSection
)
|
|
Parameters:
API Tags:
void applyDefinition(
$definition
)
|
|
Applies the definition of a form to the current stored content. This includes the validation of the text attribute (text attribute filters) as well as the verification of the available attributes per item.
The verification of the available attributes is only applies when the validation of the text attributes succeeds. Therefore you should rely on attributes only if the form has no errors.
Parameters:
API Tags:
mixed getAttribute(
$item, [
$index = null], [
$type = 'text']
)
|
|
Gets the content of an item value attribute.
Parameters:
API Tags:
Get all available errors
API Tags:
array getErrors2(
$item
)
|
|
Get errors on item level
Parameters:
API Tags:
array getErrors3(
$item, [
$index = null]
)
|
|
Get errors on item index level
Parameters:
API Tags:
array getPredefinedValues(
$item
)
|
|
Get the set of predefined values for a specific item. This is used especially for select boxes as well as for predefined indices.
Parameters:
API Tags:
string|null getTitleAttribute(
$item, [
$index = null]
)
|
|
Gets the title of an item (which is the either read from the configuration or which is in fact the title attribute).
Parameters:
API Tags:
void hasAttribute(
$item, [
$index = null], [
$type = 'text']
)
|
|
Checks for the availability of an item value attribute.
Parameters:
API Tags:
Returns true when form contains errors. False otherwise.
API Tags:
void loadFromObject(
$object, [
$definitionSection = null], [
$ignore = array()]
)
|
|
Parameters:
|
|
$object: |
|
|
|
$definitionSection: |
|
|
|
$ignore: |
|
API Tags:
void prepareAttributes(
$item,
$index,
$inputClass
)
|
|
This function applies the specific prepare function for an input class and sets the resulting attributes to the item value in question.
Parameters:
|
|
$item: |
|
|
|
$index: |
|
|
|
$inputClass: |
|
API Tags:
void setAttribute(
$value,
$item, [
$index = null], [
$type = 'text']
)
|
|
Sets the content of an item value attribute.
Parameters:
|
|
$value: |
|
|
|
$item: |
|
|
|
$index: |
|
|
|
$type: |
|
API Tags:
This function indicates if we have a form object with received values or if we have a new form object.
API Tags:
void storeToObject(
$object, [
$definitionSection = null], [
$ignore = array()]
)
|
|
Parameters:
|
|
$object: |
|
|
|
$definitionSection: |
|
|
|
$ignore: |
|
API Tags:
void validateTextFilter(
$item,
$textFilter
)
|
|
This function performs the validation of the text attribute with the text attribute filter. In case a validation failes the function adds the specific error to the form.
Parameters:
API Tags:
boolean verifyAttributes(
$item,
$requiredAttributes, [
$throwException = true]
)
|
|
This function performs the verification of the attributes. In general it checks if requested attributes are available. This is a guarantee for the developer of the business logic that he is able to work with these attributes in any case.
Parameters:
|
|
$item: |
|
|
|
$requiredAttributes: |
|
|
|
$throwException: |
|
API Tags:
void _loadFromObject(
$object,
$definition, [
$ignore = array()]
)
|
|
Parameters:
|
|
$object: |
|
|
|
$definition: |
|
|
|
$ignore: |
|
API Tags:
void _storeToObject(
$object,
$definition, [
$ignore = array()]
)
|
|
Parameters:
|
|
$object: |
|
|
|
$definition: |
|
|
|
$ignore: |
|
API Tags: