TypedDataManagerStub
extends TypedDataManager
in package
A stub of the Drupal's default TypedDataManager class.
@package TestHelpers\DrupalServiceStubs
Tags
Table of Contents
Methods
- getDefinition() : mixed
- {@inheritdoc}
- stubAddFieldType() : void
- Registers a new field type by plugin class.
- stubInitPlugin() : void
- Initiates a plugin in stub.
- stubSetDefinition() : void
- Sets a definition to stub.
- stubSetDefinitionFromClass() : void
- Sets a definition from class.
- stubSetPlugin() : void
- Sets a plugin to stub.
- getIdWithNamespace() : string
- Combined the id with namespace.
- tryLoadDefinition() : bool
- Tries to find a suitable definition class by plugin_id and load it.
Methods
getDefinition()
{@inheritdoc}
public
getDefinition(mixed $plugin_id[, mixed $exception_on_invalid = TRUE ]) : mixed
Parameters
- $plugin_id : mixed
- $exception_on_invalid : mixed = TRUE
stubAddFieldType()
Registers a new field type by plugin class.
public
stubAddFieldType(string $class) : void
Parameters
- $class : string
-
The class name.
stubInitPlugin()
Initiates a plugin in stub.
public
stubInitPlugin(string $class[, string $plugin = 'TypedData' ][, string|null $namespace = NULL ]) : void
Parameters
- $class : string
-
The class.
- $plugin : string = 'TypedData'
-
The plugin name.
- $namespace : string|null = NULL
-
The namespace to use.
stubSetDefinition()
Sets a definition to stub.
public
stubSetDefinition(mixed $definition[, string|null $namespace = NULL ][, string|null $customId = NULL ]) : void
Parameters
- $definition : mixed
-
The definition.
- $namespace : string|null = NULL
-
The namespace to use.
- $customId : string|null = NULL
-
Sets the custom id, if needed.
stubSetDefinitionFromClass()
Sets a definition from class.
public
stubSetDefinitionFromClass(string $class[, string $plugin = 'TypedData' ][, string|null $namespace = NULL ]) : void
Parameters
- $class : string
-
The class name.
- $plugin : string = 'TypedData'
-
The plugin name.
- $namespace : string|null = NULL
-
The namespace to use.
stubSetPlugin()
Sets a plugin to stub.
public
stubSetPlugin(string $class[, string $plugin = 'TypedData' ][, string|null $namespace = NULL ]) : void
Parameters
- $class : string
-
The class name.
- $plugin : string = 'TypedData'
-
The plugin name.
- $namespace : string|null = NULL
-
The namespace to use.
getIdWithNamespace()
Combined the id with namespace.
protected
getIdWithNamespace(string $id[, string|null $namespace = NULL ]) : string
Parameters
- $id : string
-
The id string.
- $namespace : string|null = NULL
-
The namespace.
Return values
string —The combined string.
tryLoadDefinition()
Tries to find a suitable definition class by plugin_id and load it.
protected
tryLoadDefinition(string $plugin_id) : bool
Parameters
- $plugin_id : string
-
The plugin id.
Return values
bool —Is the plugin found and added.