EagerLoadingFieldInterface

Type
Interface
Namespace
craft\base
Extends
craft\base\SavableComponentInterface
Implemented by
craft\fields\Matrix
Since
3.0

EagerLoadingFieldInterface defines the common interface to be implemented by field classes.

View source

Public Methods

MethodDescription
afterDelete()Performs actions after a component is deleted.
afterSave()Performs actions after a component is saved.
beforeDelete()Performs actions before a component is deleted.
beforeSave()Performs actions before a component is saved.
displayName()Returns the display name of this class.
getEagerLoadingMap()Returns an array that maps source-to-target element IDs based on this custom field.
getIsNew()Returns whether the component is new (unsaved).
getSettings()Returns an array of the component’s settings.
getSettingsHtml()Returns the component’s settings HTML.
isSelectable()Returns whether the component should be selectable in component Type selects.
settingsAttributes()Returns the list of settings attribute names.
validate()Validates the component.

getEagerLoadingMap()

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-loaded
  • map – an array of element ID mappings, where each element is a sub-array with source and target keys.
  • criteria(optional) – Any criteria parameters that should be applied to the element query when fetching the eager-loaded elements.

View source

Arguments

Returns

array, false – The eager-loading element ID mappings, or false if no mappings exist

Signature

public abstract array, false getEagerLoadingMap ( array $sourceElements )