FieldLayoutBehavior ​
- Type
- Class
- Namespace
- craft\behaviors
- Inherits
- craft\behaviors\FieldLayoutBehavior » yii\base\Behavior » yii\base\BaseObject
- Implements
- yii\base\Configurable
- Since
- 3.0.0
Field Layout behavior.
Public Properties ​
Property | Description |
---|---|
customFields | craft\base\FieldInterface[] |
elementType | class-string<\craft\base\ElementInterface> , null – The element type that the field layout will be associated with |
fieldLayout | craft\models\FieldLayout |
fieldLayoutId | integer |
idAttribute | string, null – The attribute on the owner that holds the field layout ID |
owner | craft\base\ElementInterface, yii\base\Model |
customFields
​
- Type
- craft\base\FieldInterface[]
- Default value
null
- Access
- Read-only
- Since
- 4.0.0
elementType
​
- Type
class-string<\craft\base\ElementInterface>
, null- Default value
null
The element type that the field layout will be associated with
fieldLayout
​
- Type
- craft\models\FieldLayout
- Default value
null
fieldLayoutId
​
- Type
- integer
- Default value
null
idAttribute
​
The attribute on the owner that holds the field layout ID
owner
​
- Type
- craft\base\ElementInterface, yii\base\Model
- Default value
null
Public Methods ​
Method | Description |
---|---|
__call() | Calls the named method which is not a class method. |
__construct() | Constructor. |
__get() | Returns the value of an object property. |
__isset() | Checks if a property is set, i.e. defined and not null. |
__set() | Sets value of an object property. |
__unset() | Sets an object property to null. |
attach() | Attaches the behavior object to the component. |
canGetProperty() | Returns a value indicating whether a property can be read. |
canSetProperty() | Returns a value indicating whether a property can be set. |
className() | Returns the fully qualified name of this class. |
detach() | Detaches the behavior object from the component. |
events() | Declares event handlers for the owner's events. |
getCustomFields() | Returns the custom fields associated with the owner's field layout. |
getFieldLayout() | Returns the owner's field layout. |
getFieldLayoutId() | Returns the owner's field layout ID. |
hasMethod() | Returns a value indicating whether a method is defined. |
hasProperty() | Returns a value indicating whether a property is defined. |
init() | Initializes the object. |
setFieldLayout() | Sets the owner's field layout. |
setFieldLayoutId() | Sets the owner's field layout ID. |
getCustomFields()
​
- Since
- 4.0.0
Returns the custom fields associated with the owner's field layout.
Returns ​
getFieldLayout()
​
Returns the owner's field layout.
Returns ​
Throws ​
- yii\base\InvalidConfigException
if the configured field layout ID is invalid
getFieldLayoutId()
​
Returns the owner's field layout ID.
Returns ​
Throws ​
- yii\base\InvalidConfigException
if the field layout ID could not be determined
init()
​
Initializes the object.
This method is invoked at the end of the constructor after the object is initialized with the given configuration.
Throws ​
- yii\base\InvalidConfigException
if the behavior was not configured properly
setFieldLayout()
​
Sets the owner's field layout.
Arguments ​
$fieldLayout
(craft\models\FieldLayout)
setFieldLayoutId()
​
Sets the owner's field layout ID.