API Documentation for: 1.1.1
Show:

FormFactory Class

Extends CanteenBase
Namespace: Canteen\Forms

This handles the processing and message reporting for all the site forms. Located in the namespace Canteen\Forms.

Methods

error

(
  • message
)

Report a form error

Parameters:

  • message String

    The message error to report

getData

(
  • The
)
Mixed

Get data associated with a form

Parameters:

  • The String

    name of the parameter to get

Returns:

Mixed:

The value of the data

getFeedback

() String

Return the feedback (errors and successes) as a list

Returns:

String:

The html string with errors in a UL list

parse

(
  • content
  • substitutions
)
String protected

Inherited from CanteenBase

Convenience method for parsing content

Parameters:

  • content String

    The string to parse

  • substitutions Dictionary

    The dictionary of tags to replace

Returns:

String:

The parsed string

process

(
  • formClass
  • [async=false]
)
Object

Process any forms

Parameters:

  • formClass String

    The form id (e.g. LoginForm = login-form)

  • [async=false] Boolean optional

    If the request to process is an ajax-style request

Returns:

Object:

If the request is async, the result object

service

(
  • alias
)
Service protected

Inherited from CanteenBase:

Get a service by alias

Parameters:

Returns:

Service:

The service matching the alias

setData

(
  • name
  • value
)

Set data associated with a form, can be retrieved when rendering the page using the getData method

Parameters:

  • name String

    The name of the variable to set

  • value Mixed

    The value of the data

startup

(
  • forms
)

Allow only certain forms to be run before site loads

Parameters:

  • forms String multiple

    Collection of forms that can run before anything else

success

(
  • message
)

Report a success message

Parameters:

  • message String

    The message to report success

template

(
  • name
  • [substitutions=[]
)
String protected

Inherited from CanteenBase:

Convenience method for parsing content

Parameters:

  • name String

    The name of the template to parse

  • [substitutions=[] Dictionary optional

    The dictionary of tags to replace

Returns:

String:

The parsed string

Properties

_errorMessages

Array

Contain the form errors

_formData

Array private

Contain the form data to return

_successMessages

Array private

Contain the success message

cache

ServerCache

Inherited from CanteenBase:

Get the instance of the site cache

ERROR

String final

class of ul for form errors

ifError

Boolean

If the form has an error

parser

Parser

Inherited from CanteenBase:

The parser is responsible for rendering templates

profiler

Profiler

Inherited from CanteenBase:

The instance of the profiler for debugging performance

settings

SettingsManager

Inherited from CanteenBase:

Get the instance of the settings manager

site

Site

Inherited from CanteenBase:

Convenience getter for the site

SUCCESS

String final

class of ul for form successes

user

Authorization

Inherited from CanteenBase:

Get the Authorization class to handle things like login, password change