class InputType extends Type (View source)

Abstraction that can express input types as code

Traits

Provides extensions to this object to integrate it with standard config API methods.

A class that can be instantiated or replaced via DI

Allows adding, loading, and sorting of plugins

Methods

static Config_ForClass
config()

Get a configuration accessor for this class. Short hand for Config::inst()->get($this->class, .....).

mixed
stat(string $name) deprecated

Get inherited config value

mixed
uninherited(string $name)

Gets the uninherited value for the given config option

$this
set_stat(string $name, mixed $value) deprecated

Update the config value for a given property

static Injectable
create(array ...$args)

An implementation of the factory method, allows you to create an instance of a class

static Injectable
singleton(string $class = null)

Creates a class instance by the "singleton" design pattern.

addPlugin(string $pluginName, array $config = [])

No description

removePlugin(string $pluginName)

No description

mergePlugins(array $plugins)

No description

setPlugins(array $plugins)

No description

setDefaultPlugins(array $plugins)

No description

array
getPlugins(bool $inheritDefaults = true)

No description

array
getDefaultPlugins()

No description

bool
hasPlugin(string $identifier)

No description

loadPlugins()

Translates all the ID and config settings to first class instances

array
getSortedPlugins()

Sorts the before/after of plugins using topological sort

__construct(string $name, array|null $config = null)

No description

from  Type
mixed
applyConfig(array $config)

No description

from  Type
string|null
getName()

No description

from  Type
setName(string $name)

No description

from  Type
array
getFields()

No description

from  Type
setFields(array $fields)

No description

from  Type
addField(string $fieldName, string|array|Field $fieldConfig, callable|null $callback = null)

No description

from  Type
removeField(string $field)

No description

from  Type
Field|null
getFieldByName(string $fieldName)

No description

from  Type
string|null
getDescription()

No description

from  Type
mergeWith(Type $type)

No description

from  Type
void
validate()

No description

from  Type
bool
exists()

No description

from  Type
setDescription(string|null $description)

No description

from  Type
array
getInterfaces()

No description

from  Type
string
getEncodedInterfaces()

No description

from  Type
setInterfaces(array $interfaces)

No description

from  Type
addInterface(string $name)

No description

from  Type
bool
implements(string $interfaceName)

No description

from  Type
bool
getIsInput()

No description

setIsInput(bool $isInput)

No description

from  Type
ResolverReference|null
getFieldResolver()

No description

from  Type
setFieldResolver(array|string|ResolverReference|null $fieldResolver)

No description

from  Type
string
getSignature()

A deterministic representation of everything that gets encoded into the template.

from  Type

Details

static Config_ForClass config()

Get a configuration accessor for this class. Short hand for Config::inst()->get($this->class, .....).

Return Value

Config_ForClass

mixed stat(string $name) deprecated

deprecated 5.0 Use ->config()->get() instead

Get inherited config value

Parameters

string $name

Return Value

mixed

mixed uninherited(string $name)

Gets the uninherited value for the given config option

Parameters

string $name

Return Value

mixed

$this set_stat(string $name, mixed $value) deprecated

deprecated 5.0 Use ->config()->set() instead

Update the config value for a given property

Parameters

string $name
mixed $value

Return Value

$this

static Injectable create(array ...$args)

An implementation of the factory method, allows you to create an instance of a class

This method will defer class substitution to the Injector API, which can be customised via the Config API to declare substitution classes.

This can be called in one of two ways - either calling via the class directly, or calling on Object and passing the class name as the first parameter. The following are equivalent: $list = DataList::create('SiteTree'); $list = SiteTree::get();

Parameters

array ...$args

Return Value

Injectable

static Injectable singleton(string $class = null)

Creates a class instance by the "singleton" design pattern.

It will always return the same instance for this class, which can be used for performance reasons and as a simple way to access instance methods which don't rely on instance data (e.g. the custom SilverStripe static handling).

Parameters

string $class

Optional classname to create, if the called class should not be used

Return Value

Injectable

The singleton instance

PluginConsumer addPlugin(string $pluginName, array $config = [])

Parameters

string $pluginName
array $config

Return Value

PluginConsumer

PluginConsumer removePlugin(string $pluginName)

Parameters

string $pluginName

Return Value

PluginConsumer

PluginConsumer mergePlugins(array $plugins)

Parameters

array $plugins

Return Value

PluginConsumer

PluginConsumer setPlugins(array $plugins)

Parameters

array $plugins

Return Value

PluginConsumer

Exceptions

SchemaBuilderException

PluginConsumer setDefaultPlugins(array $plugins)

Parameters

array $plugins

Return Value

PluginConsumer

Exceptions

SchemaBuilderException

array getPlugins(bool $inheritDefaults = true)

Parameters

bool $inheritDefaults

Return Value

array

array getDefaultPlugins()

Return Value

array

bool hasPlugin(string $identifier)

Parameters

string $identifier

Return Value

bool

PluginRegistry getPluginRegistry()

Return Value

PluginRegistry

Generator loadPlugins()

Translates all the ID and config settings to first class instances

Return Value

Generator

Exceptions

SchemaBuilderException
CircularDependencyException
ElementNotFoundException

array getSortedPlugins()

Sorts the before/after of plugins using topological sort

Return Value

array

Exceptions

CircularDependencyException
ElementNotFoundException

__construct(string $name, array|null $config = null)

Parameters

string $name
array|null $config

Exceptions

SchemaBuilderException

mixed applyConfig(array $config)

Parameters

array $config

Return Value

mixed

Exceptions

SchemaBuilderException

string|null getName()

Return Value

string|null

Type setName(string $name)

Parameters

string $name

Return Value

Type

array getFields()

Return Value

array

Type setFields(array $fields)

Parameters

array $fields

Return Value

Type

Exceptions

SchemaBuilderException

Type addField(string $fieldName, string|array|Field $fieldConfig, callable|null $callback = null)

Parameters

string $fieldName
string|array|Field $fieldConfig
callable|null $callback

Return Value

Type

Type removeField(string $field)

Parameters

string $field

Return Value

Type

Field|null getFieldByName(string $fieldName)

Parameters

string $fieldName

Return Value

Field|null

string|null getDescription()

Return Value

string|null

Type mergeWith(Type $type)

Parameters

Type $type

Return Value

Type

Exceptions

SchemaBuilderException

void validate()

Return Value

void

Exceptions

SchemaBuilderException

bool exists()

Return Value

bool

setDescription(string|null $description)

Parameters

string|null $description

array getInterfaces()

Return Value

array

string getEncodedInterfaces()

Return Value

string

Type setInterfaces(array $interfaces)

Parameters

array $interfaces

Return Value

Type

Type addInterface(string $name)

Parameters

string $name

Return Value

Type

bool implements(string $interfaceName)

Parameters

string $interfaceName

Return Value

bool

bool getIsInput()

Return Value

bool

Type setIsInput(bool $isInput)

Parameters

bool $isInput

Return Value

Type

ResolverReference|null getFieldResolver()

Return Value

ResolverReference|null

Type setFieldResolver(array|string|ResolverReference|null $fieldResolver)

Parameters

array|string|ResolverReference|null $fieldResolver

Return Value

Type

string getSignature()

A deterministic representation of everything that gets encoded into the template.

Used as a cache key. This method will need to be updated if new data is added to the generated code.

Return Value

string

Exceptions

Exception