setLabel()
setLabel(string $label) : \Dewdrop\Fields\FieldInterface
Set the label that should be used when displaying this field.
Parameters
string | $label |
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.
setLabel(string $label) : \Dewdrop\Fields\FieldInterface
Set the label that should be used when displaying this field.
string | $label |
setNote(string $note) : \Dewdrop\Fields\FieldInterface
Set a note that will be displayed alongside this field when it is used in a UI.
string | $note |
setId(string $id) : \Dewdrop\Fields\FieldInterface
Set the ID that should be used to identify this field in Fields collections.
string | $id |
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.
\Dewdrop\Fields | $fieldsSet |
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.
mixed | $field | |
string | $modelName |
assignHelperCallback(string $helperName, callable $callable) : \Dewdrop\Fields\FieldInterface
Assing a custom callback for use with the named field helper.
string | $helperName | |
callable | $callable |
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.
mixed | $visible |
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.
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.
\Dewdrop\Fields\UserInterface | $user |
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.
mixed | $role |
forbidVisibilityForRole(mixed $role) : \Dewdrop\Fields\FieldInterface
Forbid visibility for a specific role.
mixed | $role |
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.
mixed | $sortable |
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.
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.
\Dewdrop\Fields\UserInterface | $user |
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.
mixed | $role |
forbidSortingForRole(mixed $role) : \Dewdrop\Fields\FieldInterface
Forbid sorting for a specific role.
mixed | $role |
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.
mixed | $filterable |
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.
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.
\Dewdrop\Fields\UserInterface | $user |
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.
mixed | $role |
forbidFilteringForRole(mixed $role) : \Dewdrop\Fields\FieldInterface
Forbid filtering for a specific role.
mixed | $role |
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.
mixed | $editable |
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.
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.
\Dewdrop\Fields\UserInterface | $user |
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.
mixed | $role |
forbidEditingForRole(mixed $role) : \Dewdrop\Fields\FieldInterface
Forbid editing for a specific role.
mixed | $role |