API Documentation for: 1.1.1
Show:

SetupForm Class

Extends Form
Namespace: Canteen\Forms

Handle the necessary database and deployment setup. Located in the namespace Canteen\Forms.

Methods

arrayFilter

(
  • arr
)
Array | String private

If there's only one item in the array, return as a string, not an arra

Parameters:

  • arr Array

    The array to pass

Returns:

Array | String:

The result

createCollection

(
  • str
  • [default='']
)
Array private

Create the collection based on comma-separated, POST variable

Parameters:

  • str String

    The name of the POST variable

  • [default=''] String optional

    The default value if nothing is set

Returns:

Array:

The collection of items

error

(
  • message
)
protected

Inherited from Form:

Convenience function for passing an error to the form factory

Parameters:

  • message String

    The str error to pass

getData

(
  • name
  • value
)
protected

Inherited from Form:

Save the form data to the form factory

Parameters:

  • name String

    The name of the variable to save

  • value Mixed

    The value of the variable to save

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

privilege

(
  • [required=Privilege::GUEST]
)
protected

Inherited from Form:

You can run to make sure a process requires a particular privilege

Parameters:

  • [required=Privilege::GUEST] Int optional

    The privilege level required, default is anonymous

service

(
  • alias
)
Service protected

Inherited from CanteenBase:

Get a service by alias

Parameters:

Returns:

Service:

The service matching the alias

success

(
  • message
)
protected

Inherited from Form:

Convenience function for passing a success message to the form factory

Parameters:

  • message String

    The str success message to pass

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

verify

(
  • data
  • [type=null]
  • [suppressErrors=false]
)
Mixed protected

Inherited from Form:

Sanitize input data using the validation types above

Parameters:

  • data Mixed

    The data to be validated, can be an array of items

  • [type=null] RegExp optional

    The type of validation, defaults to Numeric. Can also be an array set of items

  • [suppressErrors=false] Boolean optional

    If we should suppress throwing errors

Returns:

Mixed:

If we don't verify and suppress errors, returns false, else returns the data

Properties

cache

ServerCache

Inherited from CanteenBase:

Get the instance of the site cache

ifError

Boolean

Inherited from Form:

If we've reported errors

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

user

Authorization

Inherited from CanteenBase:

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