class PageTypeKey extends Key (View source)

Constants

ACCESS_TYPE_INCLUDE

Access type: inclusive.

ACCESS_TYPE_EXCLUDE

Access type: exclusive.

ACCESS_TYPE_ALL

Access type: any.

Properties

$error from  ConcreteObject
protected ObjectInterface|null $permissionObject

The object for which this permission is for (for example, a Page instance).

from  Key
bool|int|string $pkID from  Key
string $pkName from  Key
string $pkHandle from  Key
string $pkDescription from  Key
bool|int|string $pkCategoryID from  Key
string $pkCategoryHandle from  Key
bool|int|string|null $pkgID from  Key
bool|int|string $pkCanTriggerWorkflow from  Key
bool|int|string $pkHasCustomClass from  Key
ObjectInterface|null $permissionObjectToCheck from  Key

Methods

loadError($error)

No description

isError()

No description

getError()

No description

setPropertiesFromArray($arr)

No description

static 
camelcase($file)

No description

static 
uncamelcase($string)

No description

array
getSupportedAccessTypes()

Get the identifiers (keys) and descriptions (values) of the access types.

from  Key
bool
canPermissionKeyTriggerWorkflow()

Returns whether a permission key can start a workflow.

from  Key
bool
permissionKeyHasCustomClass()

Returns whether a permission key has a custom class.

from  Key
string
getPermissionKeyName()

Returns the name for this permission key.

from  Key
string
getPermissionKeyDisplayName(string $format = 'html')

Returns the display name for this permission key (localized and escaped accordingly to $format).

from  Key
string
getPermissionKeyHandle()

Returns the handle for this permission key.

from  Key
string
getPermissionKeyDescription()

Returns the description for this permission key.

from  Key
string
getPermissionKeyDisplayDescription(string $format = 'html')

Returns the display description for this permission key (localized and escaped accordingly to $format).

from  Key
int
getPermissionKeyID()

Returns the ID for this permission key.

from  Key
int
getPermissionKeyCategoryID()

Returns the ID for the category of this permission key.

from  Key
string
getPermissionKeyCategoryHandle()

Returns the handle for the category of this permission key.

from  Key
setPermissionObject(ObjectInterface|null $object)

Set the object for which this permission is for (for example, a Page instance).

from  Key
getPermissionObjectToCheck()

Set the actual object that should be checked for this permission (for example, a Page instance).

from  Key
getPermissionObject()

Get the object for which this permission is for (for example, a Page instance).

from  Key
static Key[]
loadAll()

Get the list of all the defined permission keys.

from  Key
bool
hasCustomOptionsForm()

Does this permission key have a form (located at elements/permission/keys/.php)?

from  Key
int|null
getPackageID()

Get the ID of the package that defines this permission key.

from  Key
string|null
getPackageHandle()

Get the handle of the package that defines this permission key.

from  Key
static Key[]
getList(string $pkCategoryHandle, array $filters = [])

Returns the list of all permissions of this category.

from  Key
export(SimpleXMLElement $axml)

Export this permission key to a SimpleXMLElement instance.

from  Key
static 
exportList(SimpleXMLElement $xml)

Export the list of all permissions of this category to a SimpleXMLElement instance.

from  Key
static Key[]
getListByPackage(Package|Package $pkg)

Get the list of permission keys defined by a package.

from  Key
static Key
import(SimpleXMLElement $pk)

Import a permission key from a SimpleXMLElement element.

from  Key
static Key|null
getByID(int $pkID)

Get a permission key given its ID.

from  Key
static Key|null
getByHandle(string $pkHandle)

Get a permission key given its handle.

from  Key
static 
add(string $pkCategoryHandle, string $pkHandle, string $pkName, string $pkDescription, bool $pkCanTriggerWorkflow, bool $pkHasCustomClass, Package|Package|null $pkg = false)

Adds an permission key.

from  Key
setPermissionKeyHasCustomClass(bool $pkHasCustomClass)

Mark this permission key as having (or not) a custom class.

from  Key
can() deprecated

No description

from  Key
bool
validate()

Check if the current user is of for this key and its current permission object (if any).

from  Key
delete()

Delete this permission key.

from  Key
getAccessListItems()

A shortcut for grabbing the current assignment and passing into that object.

from  Key
Access|null
getPermissionAccessObject()

No description

from  Key
int|null
getPermissionAccessID()

No description

from  Key
exportAccess(SimpleXMLElement $pxml)

No description

from  Key
static Translations
exportTranslations()

Export the strings that should be translated.

from  Key
static Key|null
load(int|mixed $key, string $loadBy = 'pkID')

Load a permission key by its ID (or whatever is passed to $loadBy).

from  Key
copyFromDefaultsToPageType(Key $pk)

No description

Details

loadError($error)

No description

Parameters

$error

isError()

No description

getError()

No description

setPropertiesFromArray($arr)

No description

Parameters

$arr

static camelcase($file)

No description

Parameters

$file

static uncamelcase($string)

No description

Parameters

$string

array getSupportedAccessTypes()

Get the identifiers (keys) and descriptions (values) of the access types.

Return Value

array

bool canPermissionKeyTriggerWorkflow()

Returns whether a permission key can start a workflow.

Return Value

bool

bool permissionKeyHasCustomClass()

Returns whether a permission key has a custom class.

Return Value

bool

string getPermissionKeyName()

Returns the name for this permission key.

Return Value

string

string getPermissionKeyDisplayName(string $format = 'html')

Returns the display name for this permission key (localized and escaped accordingly to $format).

Parameters

string $format

= 'html' Escape the result in html format (if $format is 'html'). If $format is 'text' or any other value, the display name won't be escaped.

Return Value

string

string getPermissionKeyHandle()

Returns the handle for this permission key.

Return Value

string

string getPermissionKeyDescription()

Returns the description for this permission key.

Return Value

string

string getPermissionKeyDisplayDescription(string $format = 'html')

Returns the display description for this permission key (localized and escaped accordingly to $format).

Parameters

string $format

= 'html' Escape the result in html format (if $format is 'html'). If $format is 'text' or any other value, the display description won't be escaped.

Return Value

string

int getPermissionKeyID()

Returns the ID for this permission key.

Return Value

int

int getPermissionKeyCategoryID()

Returns the ID for the category of this permission key.

Return Value

int

string getPermissionKeyCategoryHandle()

Returns the handle for the category of this permission key.

Return Value

string

setPermissionObject(ObjectInterface|null $object)

Set the object for which this permission is for (for example, a Page instance).

Parameters

ObjectInterface|null $object

getPermissionObjectToCheck()

Set the actual object that should be checked for this permission (for example, a Page instance).

ObjectInterface|null getPermissionObject()

Get the object for which this permission is for (for example, a Page instance).

Return Value

ObjectInterface|null

static Key[] loadAll()

Get the list of all the defined permission keys.

Return Value

Key[]

bool hasCustomOptionsForm()

Does this permission key have a form (located at elements/permission/keys/.php)?

Return Value

bool

int|null getPackageID()

Get the ID of the package that defines this permission key.

Return Value

int|null

string|null getPackageHandle()

Get the handle of the package that defines this permission key.

Return Value

string|null

static Key[] getList(string $pkCategoryHandle, array $filters = [])

Returns the list of all permissions of this category.

Parameters

string $pkCategoryHandle
array $filters

An array containing of field name => value (to be used directly in the SQL query)

Return Value

Key[]

SimpleXMLElement export(SimpleXMLElement $axml)

Export this permission key to a SimpleXMLElement instance.

Parameters

SimpleXMLElement $axml

Return Value

SimpleXMLElement

static exportList(SimpleXMLElement $xml)

Export the list of all permissions of this category to a SimpleXMLElement instance.

Parameters

SimpleXMLElement $xml

static Key[] getListByPackage(Package|Package $pkg)

Get the list of permission keys defined by a package.

Note, this queries both the pkgID found on the PermissionKeys table AND any permission keys of a special type installed by that package, and any in categories by that package.

Parameters

Package|Package $pkg

Return Value

Key[]

static Key import(SimpleXMLElement $pk)

Import a permission key from a SimpleXMLElement element.

Parameters

SimpleXMLElement $pk

Return Value

Key

static Key|null getByID(int $pkID)

Get a permission key given its ID.

Parameters

int $pkID

Return Value

Key|null

static Key|null getByHandle(string $pkHandle)

Get a permission key given its handle.

Parameters

string $pkHandle

Return Value

Key|null

static add(string $pkCategoryHandle, string $pkHandle, string $pkName, string $pkDescription, bool $pkCanTriggerWorkflow, bool $pkHasCustomClass, Package|Package|null $pkg = false)

Adds an permission key.

Parameters

string $pkCategoryHandle
string $pkHandle
string $pkName
string $pkDescription
bool $pkCanTriggerWorkflow
bool $pkHasCustomClass
Package|Package|null $pkg

setPermissionKeyHasCustomClass(bool $pkHasCustomClass)

Mark this permission key as having (or not) a custom class.

Parameters

bool $pkHasCustomClass

can() deprecated

deprecated use the validate() method

No description

bool validate()

Check if the current user is of for this key and its current permission object (if any).

Return Value

bool

delete()

Delete this permission key.

ListItem[] getAccessListItems()

A shortcut for grabbing the current assignment and passing into that object.

Return Value

ListItem[]

Assignment getPermissionAssignmentObject()

No description

Return Value

Assignment

Access|null getPermissionAccessObject()

No description

Return Value

Access|null

int|null getPermissionAccessID()

No description

Return Value

int|null

exportAccess(SimpleXMLElement $pxml)

No description

Parameters

SimpleXMLElement $pxml

static Translations exportTranslations()

Export the strings that should be translated.

Return Value

Translations

static protected Key|null load(int|mixed $key, string $loadBy = 'pkID')

Load a permission key by its ID (or whatever is passed to $loadBy).

Parameters

int|mixed $key

the ID (or the value of the $loadBy field) of the key to be loaded

string $loadBy

the field to be used to locate the permission key

Return Value

Key|null

copyFromDefaultsToPageType(Key $pk)

No description

Parameters

Key $pk