Interface craft\base\EagerLoadingFieldInterface
- Extends
- craft\base\SavableComponentInterface
- Implemented by
- craft\fields\Assets, craft\fields\BaseRelationField, craft\fields\Categories, craft\fields\Entries, craft\fields\Matrix, craft\fields\Tags, craft\fields\Users
- Available since version
- 3.0
- Source Code
- https://github.com/craftcms/cms/blob/master/src/base/EagerLoadingFieldInterface.php
EagerLoadingFieldInterface defines the common interface to be implemented by field classes.
Method | Description | Defined By |
---|---|---|
afterDelete() |
Performs actions after a component is deleted. | craft\base\SavableComponentInterface |
afterSave() |
Performs actions after a component is saved. | craft\base\SavableComponentInterface |
beforeDelete() |
Performs actions before a component is deleted. | craft\base\SavableComponentInterface |
beforeSave() |
Performs actions before a component is saved. | craft\base\SavableComponentInterface |
displayName() |
Returns the display name of this class. | craft\base\ComponentInterface |
getEagerLoadingMap() |
Returns an array that maps source-to-target element IDs based on this custom field. | craft\base\EagerLoadingFieldInterface |
getIsNew() |
Returns whether the component is new (unsaved). | craft\base\SavableComponentInterface |
getSettings() |
Returns an array of the component’s settings. | craft\base\SavableComponentInterface |
getSettingsHtml() |
Returns the component’s settings HTML. | craft\base\SavableComponentInterface |
isSelectable() |
Returns whether the component should be selectable in component Type selects. | craft\base\SavableComponentInterface |
settingsAttributes() |
Returns the list of settings attribute names. | craft\base\SavableComponentInterface |
validate() |
Validates the component. | craft\base\SavableComponentInterface |
Method Details
getEagerLoadingMap()
public abstract method
#
Returns an array that maps source-to-target element IDs based on this custom field.
This method aids in the eager-loading of elements when performing an element query. The returned array should contain the following keys:
elementType
– the fully qualified class name of the element type that should be eager-loadedmap
– an array of element ID mappings, where each element is a sub-array withsource
andtarget
keys.criteria
(optional) – Any criteria parameters that should be applied to the element query when fetching the eager-loaded elements.
public abstract array, false getEagerLoadingMap ( array $sourceElements )
$sourceElements |
craft\base\ElementInterface[] | An array of the source elements |
return | array, false | The eager-loading element ID mappings, or false if no mappings exist |
---|