MissingComponentTrait

Type
Trait
Namespace
craft\base
Implemented by
craft\fields\MissingField, craft\volumes\MissingVolume, craft\widgets\MissingWidget
Since
3.0

MissingComponentTrait implements the common methods and properties for classes implementing craft\base\MissingComponentInterface.

View source

Public Properties

PropertyDescription
$errorMessagestring, null – The exception message that explains why the component class was invalid
$expectedTypestring, craft\base\Component, null – The expected component class name.
$settingsmixed – The custom settings associated with the component, if it is savable

$errorMessage

Type
string, null

The exception message that explains why the component class was invalid

View source

Signature

public string, null $errorMessage = null

$expectedType

Type
string, craft\base\Component, null

The expected component class name.

View source

Signature

public string, craft\base\Component, null $expectedType = null

$settings

Type
mixed
Access
Read-only

The custom settings associated with the component, if it is savable

View source

Signature

public abstract array getSettings ( )

Public Methods

MethodDescription
createFallback()Creates a new component of a given type based on this one’s properties.
getPlaceholderHtml()Displays an error message (and possibly a plugin install button) in place of the normal component UI.

createFallback()

Creates a new component of a given type based on this one’s properties.

View source

Arguments

  • $type (string) – The component class that should be used as the fallback

Returns

craft\base\ComponentInterface

Signature

public craft\base\ComponentInterface createFallback ( \craft\base\string $type )

getPlaceholderHtml()

Displays an error message (and possibly a plugin install button) in place of the normal component UI.

View source

Returns

string

Signature

public string getPlaceholderHtml ( )