Index
A
- AbstractNormForm — Class in namespace Fhooe\NormForm\Core
- NormFom is a simple template application to gather, validate and process form data in a flexible way.
B
- AbstractNormForm::business() — Method in class AbstractNormForm
- Abstract method for processing the validated form input (a.k.a. business logic). Must be implemented in the subclass.
C
- $AbstractNormForm#currentView — Property in class AbstractNormForm
- Holds the currently supplied view object that will be used in the template to render output.
D
- View::display() — Method in class View
- Displays the current view. Iterates over all the parameters and stores them in a temporary, associative array.
E
- $AbstractNormForm#errorMessages — Property in class AbstractNormForm
- An array containing all error messages being set by isValid().
F
- $PostParameter#forceEmpty — Property in class PostParameter
- A switch for forcing an always empty parameter object.
G
- GenericParameter — Class in namespace Fhooe\NormForm\Parameter
- A generic name/value parameter.
- GenericParameter::getName() — Method in class GenericParameter
- Returns the parameter's name. Always a string.
- GenericParameter::getValue() — Method in class GenericParameter
- Returns the parameter's value. Can be any data type.
- ParameterInterface::getName() — Method in class ParameterInterface
- Returns the name of the parameter. This is always a string.
- ParameterInterface::getValue() — Method in class ParameterInterface
- Returns the value of the parameter. Can be any data type.
- PostParameter::getName() — Method in class PostParameter
- Returns the parameter's name. Always a string.
- PostParameter::getValue() — Method in class PostParameter
- Updates the parameters value and then returns it. Always a string since it's form field data.
- View::getTemplateName() — Method in class View
- Returns the name of the main template that's being used for display.
- View::getParameters() — Method in class View
- Returns the supplied parameters.
I
- AbstractNormForm::isValid() — Method in class AbstractNormForm
- Abstract method used to validate the form input. Must be implemented in the subclass.
- AbstractNormForm::isFormSubmission() — Method in class AbstractNormForm
- Checks if the current request was an initial one (thus using GET) or a recurring one after a form submission (where POST was used).
- AbstractNormForm::isEmptyPostField() — Method in class AbstractNormForm
- Convenience method to check if a form field is empty, thus contains only an empty string. This is preferred to PHP's own empty() method which also defines inputs such as "0" as empty.
L
- $View#loader — Property in class View
- The Twig loader instance.
N
- AbstractNormForm::normForm() — Method in class AbstractNormForm
- Main "decision" method for the form processing. This decision tree uses isFormSubmission() to check if the form is being initially displayed or shown again after a form submission and either calls show() to display the form (using the supplied View object) or validate the received input in isValid(). If validation failed, show() is called again. Possible error messages provided as parameters to the View object in isValid() can now be displayed. Once the submission was correct, business() is called where the data can be processed as needed.
- $GenericParameter#name — Property in class GenericParameter
- The name of the parameter. Always a string.
- $PostParameter#name — Property in class PostParameter
- The name of the parameter. Always a string.
P
- ParameterInterface — Class in namespace Fhooe\NormForm\Parameter
- Defines an interface for parameters that are passed on to a View object.
- PostParameter — Class in namespace Fhooe\NormForm\Parameter
- A special parameter that represents an entry in the $_POST superglobal.
- $View#params — Property in class View
- An array of parameters used for display.
R
- View::redirectTo() — Method in class View
- Performs a generic redirect using header(). GET-Parameters may optionally be supplied as an associative array.
S
- $AbstractNormForm#statusMessage — Property in class AbstractNormForm
- An optional status message that can be set in business() when processing data was successful.
- AbstractNormForm::show() — Method in class AbstractNormForm
- Used to display output. The currently used object of type View is used to display the content by calling the display() method. Depending on the type of View object, a certain template engine will be used to render the output. The view object will handle passing on the parameters to the template engine.
- View::setParameter() — Method in class View
- Allows to add or redefine parameters when the view object already exists. This avoids having to create a completely new view object just because one parameter has changed or needs to be added. This method first checks if a parameter with the given name is already stored within the view. If so, it updates its value with the one supplied in $param. If the parameter is not present in the view, it is being added.
T
- $View#templateName — Property in class View
- The name of the view (the template file that is to be rendered).
- $View#templateDirectory — Property in class View
- The relative path to the directory where the template files are stored.
- $View#templateCacheDirectory — Property in class View
- The relative path where cached/compiled templates are to be stored.
- $View#twig — Property in class View
- The main instance of the Twig template engine (environment).
U
- PostParameter::updateValue() — Method in class PostParameter
- Private method for updating the parameter's value. Checks if there is an entry in the $_POST superglobal.
V
- $GenericParameter#value — Property in class GenericParameter
- The value of the parameter. Can hold any data type.
- $PostParameter#value — Property in class PostParameter
- The value of the parameter. Can hold any data type.
- View — Class in namespace Fhooe\NormForm\View
- Encapsulates data for displaying a form or result of a form submission and uses the Twig template engine to render its output.
_
- AbstractNormForm::__construct() — Method in class AbstractNormForm
- Creates a new instance for a norm form object and initializes all necessary fields. A View object is used to initially define how and where output is displayed via the template engine and supply parameters to the template.
- GenericParameter::__construct() — Method in class GenericParameter
- Creates a new parameter using the supplied name and value.
- PostParameter::__construct() — Method in class PostParameter
- Creates a new parameter for the form field/$_POST entry with the name specified in $postName.
- View::__construct() — Method in class View
- Creates a new view with the main template to be displayed, the path to the template and compiled templates directory as well as parameters of the form. Also initializes the Twig template engine with caching and auto reload enabled.