Skip to content

ComponentInterface ​

Type
Interface
Namespace
craft\base
Extends
craft\base\ModelInterface
Implemented by
craft\assetpreviews\Image, craft\assetpreviews\Pdf, craft\assetpreviews\Text, craft\assetpreviews\Video, craft\auth\methods\AuthMethodInterface, craft\auth\methods\BaseAuthMethod, craft\auth\methods\RecoveryCodes, craft\auth\methods\TOTP, craft\auth\sso\BaseExternalProvider, craft\auth\sso\BaseProvider, craft\auth\sso\CraftProvider, craft\auth\sso\ProviderInterface, craft\auth\sso\mapper\ExplicitUserMapper, craft\auth\sso\mapper\IdpAttributeUserMapper, craft\auth\sso\mapper\TemplateValueUserMapper, craft\base\AssetPreviewHandler, craft\base\Component, craft\base\ConfigurableComponent, craft\base\ConfigurableComponentInterface, craft\base\Element, craft\base\ElementAction, craft\base\ElementExporter, craft\base\ElementExporterInterface, craft\base\ElementInterface, craft\base\Field, craft\base\Fs, craft\base\SavableComponent, craft\base\Utility, craft\base\UtilityInterface, craft\base\Widget, craft\base\conditions\BaseCondition, craft\base\conditions\BaseConditionRule, craft\base\conditions\BaseDateRangeConditionRule, craft\base\conditions\BaseElementSelectConditionRule, craft\base\conditions\BaseLightswitchConditionRule, craft\base\conditions\BaseMultiSelectConditionRule, craft\base\conditions\BaseNumberConditionRule, craft\base\conditions\BaseSelectConditionRule, craft\base\conditions\BaseTextConditionRule, craft\base\conditions\ConditionRuleInterface, craft\elements\Address, craft\elements\Asset, craft\elements\Category, craft\elements\Entry, craft\elements\GlobalSet, craft\elements\Tag, craft\elements\User, craft\elements\actions\ChangeSortOrder, craft\elements\actions\CopyReferenceTag, craft\elements\actions\CopyUrl, craft\elements\actions\Delete, craft\elements\actions\DeleteAssets, craft\elements\actions\DeleteForSite, craft\elements\actions\DeleteUsers, craft\elements\actions\DownloadAssetFile, craft\elements\actions\Duplicate, craft\elements\actions\Edit, craft\elements\actions\EditImage, craft\elements\actions\MoveAssets, craft\elements\actions\MoveToSection, craft\elements\actions\NewChild, craft\elements\actions\NewSiblingAfter, craft\elements\actions\NewSiblingBefore, craft\elements\actions\PreviewAsset, craft\elements\actions\RenameFile, craft\elements\actions\ReplaceFile, craft\elements\actions\Restore, craft\elements\actions\SetStatus, craft\elements\actions\ShowInFolder, craft\elements\actions\SuspendUsers, craft\elements\actions\UnsuspendUsers, craft\elements\actions\View, craft\elements\conditions\DateCreatedConditionRule, craft\elements\conditions\DateUpdatedConditionRule, craft\elements\conditions\ElementCondition, craft\elements\conditions\HasDescendantsRule, craft\elements\conditions\HasUrlConditionRule, craft\elements\conditions\IdConditionRule, craft\elements\conditions\LanguageConditionRule, craft\elements\conditions\LevelConditionRule, craft\elements\conditions\NotRelatedToConditionRule, craft\elements\conditions\RelatedToConditionRule, craft\elements\conditions\SiteConditionRule, craft\elements\conditions\SiteGroupConditionRule, craft\elements\conditions\SlugConditionRule, craft\elements\conditions\StatusConditionRule, craft\elements\conditions\TitleConditionRule, craft\elements\conditions\UriConditionRule, craft\elements\conditions\addresses\AddressCondition, craft\elements\conditions\addresses\AddressLine1ConditionRule, craft\elements\conditions\addresses\AddressLine2ConditionRule, craft\elements\conditions\addresses\AddressLine3ConditionRule, craft\elements\conditions\addresses\AdministrativeAreaConditionRule, craft\elements\conditions\addresses\CountryConditionRule, craft\elements\conditions\addresses\DependentLocalityConditionRule, craft\elements\conditions\addresses\FullNameConditionRule, craft\elements\conditions\addresses\LocalityConditionRule, craft\elements\conditions\addresses\OrganizationConditionRule, craft\elements\conditions\addresses\OrganizationTaxIdConditionRule, craft\elements\conditions\addresses\PostalCodeConditionRule, craft\elements\conditions\addresses\SortingCodeConditionRule, craft\elements\conditions\assets\AssetCondition, craft\elements\conditions\assets\DateModifiedConditionRule, craft\elements\conditions\assets\FileSizeConditionRule, craft\elements\conditions\assets\FileTypeConditionRule, craft\elements\conditions\assets\FilenameConditionRule, craft\elements\conditions\assets\HasAltConditionRule, craft\elements\conditions\assets\HeightConditionRule, craft\elements\conditions\assets\SavableConditionRule, craft\elements\conditions\assets\UploaderConditionRule, craft\elements\conditions\assets\ViewableConditionRule, craft\elements\conditions\assets\VolumeConditionRule, craft\elements\conditions\assets\WidthConditionRule, craft\elements\conditions\categories\CategoryCondition, craft\elements\conditions\categories\GroupConditionRule, craft\elements\conditions\entries\AuthorConditionRule, craft\elements\conditions\entries\AuthorGroupConditionRule, craft\elements\conditions\entries\EntryCondition, craft\elements\conditions\entries\ExpiryDateConditionRule, craft\elements\conditions\entries\MatrixFieldConditionRule, craft\elements\conditions\entries\PostDateConditionRule, craft\elements\conditions\entries\SavableConditionRule, craft\elements\conditions\entries\SectionConditionRule, craft\elements\conditions\entries\TypeConditionRule, craft\elements\conditions\entries\ViewableConditionRule, craft\elements\conditions\tags\GroupConditionRule, craft\elements\conditions\tags\TagCondition, craft\elements\conditions\users\AdminConditionRule, craft\elements\conditions\users\CredentialedConditionRule, craft\elements\conditions\users\EmailConditionRule, craft\elements\conditions\users\FirstNameConditionRule, craft\elements\conditions\users\GroupConditionRule, craft\elements\conditions\users\LastLoginDateConditionRule, craft\elements\conditions\users\LastNameConditionRule, craft\elements\conditions\users\UserCondition, craft\elements\conditions\users\UsernameConditionRule, craft\elements\exporters\Expanded, craft\elements\exporters\Raw, 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\MissingField, craft\fields\Money, craft\fields\MultiSelect, craft\fields\Number, craft\fields\PlainText, craft\fields\RadioButtons, craft\fields\Range, craft\fields\Table, craft\fields\Tags, craft\fields\Time, craft\fields\Users, craft\fields\conditions\CountryFieldConditionRule, craft\fields\conditions\DateFieldConditionRule, craft\fields\conditions\EmptyFieldConditionRule, craft\fields\conditions\LightswitchFieldConditionRule, craft\fields\conditions\MoneyFieldConditionRule, craft\fields\conditions\NumberFieldConditionRule, craft\fields\conditions\OptionsFieldConditionRule, craft\fields\conditions\RelationalFieldConditionRule, craft\fields\conditions\TextFieldConditionRule, craft\fields\linktypes\Asset, craft\fields\linktypes\BaseElementLinkType, craft\fields\linktypes\BaseLinkType, craft\fields\linktypes\BaseTextLinkType, craft\fields\linktypes\Category, craft\fields\linktypes\Email, craft\fields\linktypes\Entry, craft\fields\linktypes\Phone, craft\fields\linktypes\Url, craft\fs\Local, craft\fs\MissingFs, craft\fs\Temp, craft\gql\ArgumentManager, craft\gql\ElementQueryConditionBuilder, craft\gql\TypeManager, craft\gql\base\ElementMutationResolver, craft\gql\base\MutationResolver, craft\gql\resolvers\mutations\Asset, craft\gql\resolvers\mutations\Category, craft\gql\resolvers\mutations\Entry, craft\gql\resolvers\mutations\GlobalSet, craft\gql\resolvers\mutations\Tag, craft\imagetransforms\FallbackTransformer, craft\imagetransforms\ImageTransformer, craft\mail\transportadapters\BaseTransportAdapter, craft\mail\transportadapters\Gmail, craft\mail\transportadapters\Sendmail, craft\mail\transportadapters\Smtp, craft\test\mockclasses\components\ComponentExample, craft\test\mockclasses\components\DependencyHeavyComponentExample, craft\test\mockclasses\components\EventTriggeringComponent, craft\test\mockclasses\components\ExtendedComponentExample, craft\test\mockclasses\elements\ExampleElement, craft\utilities\AssetIndexes, craft\utilities\ClearCaches, craft\utilities\DbBackup, craft\utilities\DeprecationErrors, craft\utilities\FindAndReplace, craft\utilities\Migrations, craft\utilities\PhpInfo, craft\utilities\ProjectConfig, craft\utilities\QueueManager, craft\utilities\SystemMessages, craft\utilities\SystemReport, craft\utilities\Updates, craft\utilities\Upgrade, craft\widgets\CraftSupport, craft\widgets\Feed, craft\widgets\MissingWidget, craft\widgets\MyDrafts, craft\widgets\NewUsers, craft\widgets\QuickPost, craft\widgets\RecentEntries, craft\widgets\Updates
Since
3.0.0

ComponentInterface defines the common interface to be implemented by Craft component classes.

A class implementing this interface should extend craft\base\Model.

View source

Public Methods ​

MethodDescription
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.
instance()Returns static class instance, which can be used to obtain meta information.
isSelectable()Returns whether the component should be selectable in component Type selects.
toArray()Converts the object into an array.

displayName() ​

Returns the display name of this class.

View source

Returns ​

string – The display name of this class.

isSelectable() ​

Since
3.5.0

Returns whether the component should be selectable in component Type selects.

View source

Returns ​

boolean – Whether the component should be selectable in component Type selects.