Skip to content

MergeableFieldInterface

Type
Interface
Namespace
craft\base
Extends
craft\base\FieldInterface
Implemented by
craft\fields\Addresses, craft\fields\Assets, craft\fields\BaseOptionsField, craft\fields\BaseRelationField, craft\fields\Categories, craft\fields\Checkboxes, craft\fields\Color, craft\fields\Country, craft\fields\Date, craft\fields\Dropdown, craft\fields\Email, craft\fields\Entries, craft\fields\Icon, craft\fields\Lightswitch, craft\fields\Link, craft\fields\Matrix, craft\fields\Money, craft\fields\MultiSelect, craft\fields\Number, craft\fields\PlainText, craft\fields\RadioButtons, craft\fields\Range, craft\fields\Tags, craft\fields\Time, craft\fields\Users
Since
5.3.0

MergeableFieldInterface defines the common interface to be implemented by field classes that can be merged with other fields.

View source

Public Methods

MethodDescription
afterDelete()Performs actions after a component is deleted.
afterElementDelete()Performs actions after the element has been deleted.
afterElementDeleteForSite()Performs actions after the element has been deleted.
afterElementPropagate()Performs actions after the element has been fully saved and propagated to other sites.
afterElementRestore()Performs actions after the element has been restored.
afterElementSave()Performs actions after the element has been saved.
afterMergeFrom()Performs actions after the given field has been merged into this one.
afterMergeInto()Performs actions after the field has been merged into the given field.
afterSave()Performs actions after a component is saved.
beforeApplyDelete()Performs actions before a component delete is applied to the database.
beforeDelete()Performs actions before a component is deleted.
beforeElementDelete()Performs actions before an element is deleted.
beforeElementDeleteForSite()Performs actions before an element is deleted for a site.
beforeElementRestore()Performs actions before an element is restored.
beforeElementSave()Performs actions before an element is saved.
beforeSave()Performs actions before a component is saved.
canMergeFrom()Returns whether the given field can be merged into this one.
canMergeInto()Returns whether the field can be merged into the given field.
copyValue()Copies the field’s value from one element to another.
dbType()Returns the DB data type(s) that this field will store within the elements_sites.content column.
displayName()Returns the display name of this class.
extraFields()Returns the list of additional fields that can be returned by toArray() in addition to those listed in fields().
fields()Returns the list of fields that should be returned by default by toArray() when no specific fields are specified.
get()Returns a component by its ID.
getContentGqlMutationArgumentType()Returns the GraphQL type to be used as an argument in mutations for this field type.
getContentGqlQueryArgumentType()Returns the GraphQL type to be used as an argument in queries for this field type.
getContentGqlType()Returns the GraphQL type to be used for this field type.
getCpEditUrl()Returns the URL to the component’s edit page in the control panel.
getElementConditionRuleType()Returns the element condition rule class that should be used for this field.
getElementValidationRules()Returns the validation rules for an element with this field.
getHandle()Returns the handle of the component.
getId()Returns the ID of the component, which should be used as the value of hidden inputs.
getInputHtml()Returns the field’s input HTML.
getInputId()Returns the input’s ID, which the <label>’s for attribute should reference.
getIsNew()Returns whether the component is new (unsaved).
getIsTranslatable()Returns whether the field should be shown as translatable in the UI.
getLabelId()Returns the input’s label ID.
getOrientation()Returns the orientation the field should use (ltr or rtl).
getSearchKeywords()Returns the search keywords that should be associated with this field.
getSettings()Returns an array of the component’s settings.
getSettingsHtml()Returns the component’s settings HTML.
getStaticHtml()Returns a static (non-editable) version of the field’s input HTML.
getStatus()Returns the status of the field for a given element.
getTranslationDescription()Returns the description of this field’s translation support.
getTranslationKey()Returns the field’s translation key, based on a given element.
getUiLabel()Returns what the component should be called within the control panel.
getValueSql()Returns a SQL expression which extracts the field’s value from the elements_sites.content column.
icon()Returns the field type’s SVG icon.
includeInGqlSchema()Returns whether the field should be included in the given GraphQL schema.
instance()Returns static class instance, which can be used to obtain meta information.
isMultiInstance()Returns whether the field can be included multiple times within a field layout.
isRequirable()Returns whether the field can be marked as required.
isSelectable()Returns whether the component should be selectable in component Type selects.
isValueEmpty()Returns whether the given value should be considered “empty” to a validator.
modifyElementIndexQuery()Modifies an element index query.
normalizeValue()Normalizes the field’s value for use.
normalizeValueFromRequest()Normalizes a posted field value for use.
phpType()Returns the PHPDoc type this field’s values will have.
queryCondition()Returns a query builder-compatible condition for the given field instances, for a user-provided param value.
serializeValue()Prepares the field’s value to be stored somewhere, like the content table.
setIsFresh()Sets whether the field is fresh.
settingsAttributes()Returns the list of settings attribute names.
supportedTranslationMethods()Returns which translation methods the field supports.
toArray()Converts the object into an array.
useFieldset()Returns whether the field should use a <fieldset> + <legend> instead of a <div> + <label>.

afterMergeFrom()

Performs actions after the given field has been merged into this one.

View source

Arguments

afterMergeInto()

Performs actions after the field has been merged into the given field.

View source

Arguments

canMergeFrom()

Returns whether the given field can be merged into this one.

View source

Arguments

Returns

boolean

canMergeInto()

Returns whether the field can be merged into the given field.

View source

Arguments

Returns

boolean