\Dewdrop\FieldsFieldInterface

All fields implement this interface. It covers 3 core field responsibilities:

1) Identification and labeling of fields.

2) Assignment and management of field helper callbacks for the field.

3) Management of the 4 core field permissions: visible, sortable, filterable, and editable.

Summary

Methods
Constants
setLabel()
getLabel()
setNote()
getNote()
setId()
getId()
getName()
getHtmlId()
getQueryStringId()
setFieldsSet()
add()
assignHelperCallback()
hasHelperCallback()
getHelperCallback()
getAllHelperCallbacks()
getHelperFilters()
addHelperFilter()
setVisible()
getVisibleSetting()
isVisible()
allowVisibilityForRole()
forbidVisibilityForRole()
setSortable()
getSortableSetting()
isSortable()
allowSortingForRole()
forbidSortingForRole()
setFilterable()
getFilterableSetting()
isFilterable()
allowFilteringForRole()
forbidFilteringForRole()
setEditable()
getEditableSetting()
isEditable()
allowEditingForRole()
forbidEditingForRole()
setValue()
getValue()
applyTemplate()
No constants found
No protected methods found
N/A
No private methods found
N/A

Methods

setLabel()

setLabel(string  $label) : \Dewdrop\Fields\FieldInterface

Set the label that should be used when displaying this field.

Parameters

string $label

Returns

\Dewdrop\Fields\FieldInterface

getLabel()

getLabel() : string

Get the label that should be used when displaying this field.

Returns

string

setNote()

setNote(string  $note) : \Dewdrop\Fields\FieldInterface

Set a note that will be displayed alongside this field when it is used in a UI.

Parameters

string $note

Returns

\Dewdrop\Fields\FieldInterface

getNote()

getNote() : string

Get the note associated with this field.

Returns

string

setId()

setId(string  $id) : \Dewdrop\Fields\FieldInterface

Set the ID that should be used to identify this field in Fields collections.

Parameters

string $id

Returns

\Dewdrop\Fields\FieldInterface

getId()

getId() : string

Get the ID that should be used to identify this field in Fields collections.

Returns

string

getName()

getName() : string

Get the name used to represent this field in result sets.

Returns

string

getHtmlId()

getHtmlId() : string

Get an ID for this field that doesn't contain any special characters not allowed in HTML ID attributes and/or CSS selectors.

Returns

string

getQueryStringId()

getQueryStringId() : string

Get an ID for this field that doesn't contain any special characters not allowed in URL query strings.

Returns

string

setFieldsSet()

setFieldsSet(\Dewdrop\Fields  $fieldsSet) : \Dewdrop\Fields\FieldAbstract

Set the FieldsSet that contains this FieldAbstract object. Note that once this is set, it cannot be changed without first calling resetFieldsSet().

This is done to ensure that when chaining calls between this field and its containing set, the same set is always used. This avoids inconsistent or unpredictable cases where the field is added to one set but later customized on a derivitive set.

Parameters

\Dewdrop\Fields $fieldsSet

Returns

\Dewdrop\Fields\FieldAbstract

add()

add(mixed  $field, string  $modelName = null) : mixed

When calling add() on this field, it will delegate the call back up to the associated \Dewdrop\Fields object. This allows for a very fluid method chaining style when defining a large set of fields.

Parameters

mixed $field
string $modelName

Throws

\Dewdrop\Fields\Exception

Returns

mixed

assignHelperCallback()

assignHelperCallback(string  $helperName, callable  $callable) : \Dewdrop\Fields\FieldInterface

Assing a custom callback for use with the named field helper.

Parameters

string $helperName
callable $callable

Returns

\Dewdrop\Fields\FieldInterface

hasHelperCallback()

hasHelperCallback(string  $helperName) : boolean

Check to see if this field has a custom callback defined for the supplied helper name.

Parameters

string $helperName

Returns

boolean

getHelperCallback()

getHelperCallback(string  $helperName) : callable

Get the callback assigned to this field for the supplied helper name.

Parameters

string $helperName

Returns

callable

getAllHelperCallbacks()

getAllHelperCallbacks() : array

Get all helper callbacks that have been assigned to this field.

The returned array with have helper names as keys and the callables themselves as values. Mostly useful in debugging/introspection contexts.

Returns

array

getHelperFilters()

getHelperFilters(  $helperName) : array

Get any filters supplied for the given helper name.

Parameters

$helperName

Returns

array

addHelperFilter()

addHelperFilter(string  $helperName, callable  $filter) : $this

Parameters

string $helperName
callable $filter

Returns

$this

setVisible()

setVisible(mixed  $visible) : \Dewdrop\Fields\FieldInterface

Set whether this field should be visible. Can supply either a boolean, in which case true means globally allowed and false means globally forbidden, or an array of roles/capabilities for which it is allowed.

Parameters

mixed $visible

Returns

\Dewdrop\Fields\FieldInterface

getVisibleSetting()

getVisibleSetting() : array

Get the current setting for this field's visibility. Will return an empty array if completely forbidden, an array containing only \Dewdrop\Fields\FieldAbstract::AUTHORIZATION_ALLOW_ALL if completely allowed, or an array containing 1 or more roles if a custom setting is applied.

Returns

array

isVisible()

isVisible(\Dewdrop\Fields\UserInterface  $user = null) : boolean

Check to see if this field is visible. If no user is supplied, this method will only return true when the field is visible globally. Otherwise, it will check to see if the user has a matching role/capability.

Parameters

\Dewdrop\Fields\UserInterface $user

Returns

boolean

allowVisibilityForRole()

allowVisibilityForRole(mixed  $role) : \Dewdrop\Fields\FieldInterface

Enable visibility for a specific role. You can call this multiple times to configure the field for all roles, or call setVisible() once with an array of roles.

Parameters

mixed $role

Returns

\Dewdrop\Fields\FieldInterface

forbidVisibilityForRole()

forbidVisibilityForRole(mixed  $role) : \Dewdrop\Fields\FieldInterface

Forbid visibility for a specific role.

Parameters

mixed $role

Returns

\Dewdrop\Fields\FieldInterface

setSortable()

setSortable(mixed  $sortable) : \Dewdrop\Fields\FieldInterface

Set whether this field should be sortable. Can supply either a boolean, in which case true means globally allowed and false means globally forbidden, or an array of roles/capabilities for which it is allowed.

Parameters

mixed $sortable

Returns

\Dewdrop\Fields\FieldInterface

getSortableSetting()

getSortableSetting() : array

Get the current setting for this field's sortability. Will return an empty array if completely forbidden, an array containing only \Dewdrop\Fields\FieldAbstract::AUTHORIZATION_ALLOW_ALL if completely allowed, or an array containing 1 or more roles if a custom setting is applied.

Returns

array

isSortable()

isSortable(\Dewdrop\Fields\UserInterface  $user = null) : boolean

Check to see if this field is sortable. If no user is supplied, this method will only return true when the field is visible globally. Otherwise, it will check to see if the user has a matching role/capability.

Parameters

\Dewdrop\Fields\UserInterface $user

Returns

boolean

allowSortingForRole()

allowSortingForRole(mixed  $role) : \Dewdrop\Fields\FieldInterface

Enable sorting for a specific role. You can call this multiple times to configure the field for all roles, or call setSortable() once with an array of roles.

Parameters

mixed $role

Returns

\Dewdrop\Fields\FieldInterface

forbidSortingForRole()

forbidSortingForRole(mixed  $role) : \Dewdrop\Fields\FieldInterface

Forbid sorting for a specific role.

Parameters

mixed $role

Returns

\Dewdrop\Fields\FieldInterface

setFilterable()

setFilterable(mixed  $filterable) : \Dewdrop\Fields\FieldInterface

Set whether this field should be filterable. Can supply either a boolean, in which case true means globally allowed and false means globally forbidden, or an array of roles/capabilities for which it is allowed.

Parameters

mixed $filterable

Returns

\Dewdrop\Fields\FieldInterface

getFilterableSetting()

getFilterableSetting() : array

Get the current setting for this field's filterability. Will return an empty array if completely forbidden, an array containing only \Dewdrop\Fields\FieldAbstract::AUTHORIZATION_ALLOW_ALL if completely allowed, or an array containing 1 or more roles if a custom setting is applied.

Returns

array

isFilterable()

isFilterable(\Dewdrop\Fields\UserInterface  $user = null) : boolean

Check to see if this field is filterable. If no user is supplied, this method will only return true when the field is visible globally. Otherwise, it will check to see if the user has a matching role/capability.

Parameters

\Dewdrop\Fields\UserInterface $user

Returns

boolean

allowFilteringForRole()

allowFilteringForRole(mixed  $role) : \Dewdrop\Fields\FieldInterface

Enable filtering for a specific role. You can call this multiple times to configure the field for all roles, or call setFilterable() once with an array of roles.

Parameters

mixed $role

Returns

\Dewdrop\Fields\FieldInterface

forbidFilteringForRole()

forbidFilteringForRole(mixed  $role) : \Dewdrop\Fields\FieldInterface

Forbid filtering for a specific role.

Parameters

mixed $role

Returns

\Dewdrop\Fields\FieldInterface

setEditable()

setEditable(mixed  $editable) : \Dewdrop\Fields\FieldInterface

Set whether this field should be editable. Can supply either a boolean, in which case true means globally allowed and false means globally forbidden, or an array of roles/capabilities for which it is allowed.

Parameters

mixed $editable

Returns

\Dewdrop\Fields\FieldInterface

getEditableSetting()

getEditableSetting() : array

Get the current setting for this field's editability. Will return an empty array if completely forbidden, an array containing only \Dewdrop\Fields\FieldAbstract::AUTHORIZATION_ALLOW_ALL if completely allowed, or an array containing 1 or more roles if a custom setting is applied.

Returns

array

isEditable()

isEditable(\Dewdrop\Fields\UserInterface  $user = null) : boolean

Check to see if this field is editable. If no user is supplied, this method will only return true when the field is visible globally. Otherwise, it will check to see if the user has a matching role/capability.

Parameters

\Dewdrop\Fields\UserInterface $user

Returns

boolean

allowEditingForRole()

allowEditingForRole(mixed  $role) : \Dewdrop\Fields\FieldInterface

Enable editing for a specific role. You can call this multiple times to configure the field for all roles, or call setEditable() once with an array of roles.

Parameters

mixed $role

Returns

\Dewdrop\Fields\FieldInterface

forbidEditingForRole()

forbidEditingForRole(mixed  $role) : \Dewdrop\Fields\FieldInterface

Forbid editing for a specific role.

Parameters

mixed $role

Returns

\Dewdrop\Fields\FieldInterface

setValue()

setValue(mixed  $value) : mixed

Set a value for this field.

Parameters

mixed $value

Returns

mixed

getValue()

getValue() : mixed

Return the value for this field.

Returns

mixed

applyTemplate()

applyTemplate(callable  $template) : $this

Apply a template to this field.

Parameters

callable $template

Returns

$this