API Documentation for: 1.1.1
Show:

ObjectForm Class

Extends Form
Namespace: Canteen\Forms

Generalized form for processing ObjectServiceItem objects

Constructor

ObjectForm

(
  • item
  • redirect
)

Parameters:

Methods

add

() protected

Add a new object

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

getObject

(
  • id
)
Object private

Generalized get object by ID

Parameters:

  • id Int

    The unique object id

Returns:

Object:

The object, or null

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

remove

() protected

Generalized remove function

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

update

() protected

Update the object

validate

() private

Do some initial sanitize

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

addRedirect

Boolean protected

If we should redirect after an add

Default: true

cache

ServerCache

Inherited from CanteenBase:

Get the instance of the site cache

ifError

Boolean

Inherited from Form:

If we've reported errors

item

ObjectServiceItem protected

The object service item reference

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

redirect

String protected

The redirect uri after remove or add

removeRedirect

Boolean protected

If we should redirect after a remove

Default: true

settings

SettingsManager

Inherited from CanteenBase:

Get the instance of the settings manager

site

Site

Inherited from CanteenBase:

Convenience getter for the site

updateNothingError

Boolean protected

If we should do the update nothing error

Default: true

updateRedirect

Boolean protected

If we should redirect after an update

Default: true

user

Authorization

Inherited from CanteenBase:

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