API Documentation for: 1.1.1
Show:

AdminObjectController Class

Admin controller for standard object editing Located in the namespace Canteen\Controllers.

Constructor

AdminObjectController

(
  • item
  • formName
  • [titleName='title']
)

Parameters:

  • item ObjectServiceItem

    The item render with controller

  • formName String

    The full class name of the form

  • [titleName='title'] String optional

    The name of the object field to use as select title

Methods

addData

(
  • name
  • value
)

Inherited from Controller:

Add a data substitution variable

Parameters:

  • name String | Dictionary | Object

    The name of the data variable or an array of (name=>value, name=>value)

  • value Mixed

    The string of the value (optional if setting one data property)

addElement

(
  • element
)
protected

Add a custom form element

Parameters:

addNotice

(
  • message
)
protected

Add a notice to the buffer output

Parameters:

  • message String

    The message to output

addTemplate

(
  • template
  • [data=[]
)
protected

Inherited from AdminController:

Add the admin page by template, if there is no template use the default prerender() method

Parameters:

  • template String

    The template name

  • [data=[] Dictionary optional

    The optional substitution variables

addTitle

(
  • title
  • [separator=.]
)

Inherited from Controller:

Prepend to the page title

Parameters:

  • title String

    The title string to prepend

  • [separator=.] String optional

    The title separator, default is a period

getData

() Dictionary

Inherited from Controller:

Get the data variables

Returns:

Dictionary:

Data variables for substitution

getPage

() Page

Inherited from Controller

Get the current page object, this is an override before returning the page, we render the navigation

Returns:

Page:

The updated page object

ignoreFields

(
  • fields
)

Ignore field names

Parameters:

  • fields String multiple

    The field name as separate arguments

optionalFields

(
  • fields
)

Don't add the required class to these fields

Parameters:

  • fields String multiple

    The field name as separate arguments

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

pre-render

() private

Inherited from AdminController:

Pre-render the admin page with the navigation

process

()

Inherited from Controller

The process method contains nothing navigation is created when renderNavigation is called.

service

(
  • alias
)
Service protected

Inherited from CanteenBase:

Get a service by alias

Parameters:

Returns:

Service:

The service matching the alias

setPage

(
  • page
)

Inherited from Controller:

Set the current page

Parameters:

  • page Page

    The page to build with this Controller

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

_isPrerendered

Boolean private

Inherited from AdminController:

Check to see if we've already been pre-rendered

allObjects

Array protected

The collection of all object, this can be used to eliminate an additional database request for all the pages.

cache

ServerCache

Inherited from CanteenBase:

Get the instance of the site cache

data

Dictionary protected

Inherited from Controller:

Any custom substitutions for the parser

dynamicUri

String protected

Inherited from Controller:

For dynamic pages, the extra stuff after the page URI

formName

String protected

The name of the full form

getObject

String protected

The method name on the item service to get the object by id

getObjects

String protected

The method name on the item service to get all objects

ignoreFields

Array private

The collection of field names which we should ignore render for

object

Object protected

The selected object

optionalFields

Array private

The collection of field names which are optional to input

page

Page protected

Inherited from Controller:

The the current page

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

removeEnabled

Boolean protected

If the delete button is enabled

Default: true

settings

SettingsManager

Inherited from CanteenBase:

Get the instance of the settings manager

site

Site

Inherited from CanteenBase:

Convenience getter for the site

titleName

String protected

The name of the item field for use in the select form list

Default: 'title'

user

Authorization

Inherited from CanteenBase:

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