FieldItemListStubFactory
in package
The FieldItemListStubFactory class.
Table of Contents
Methods
- __construct() : mixed
- Constructs a new EntityStubFactory.
- create() : FieldItemListInterface
- Creates a field instance stub.
- createFieldItemDefinitionStub() : FieldDefinitionInterface
- Creates a field definition stub.
Methods
__construct()
Constructs a new EntityStubFactory.
public
__construct() : mixed
create()
Creates a field instance stub.
public
static create([string|null $name = NULL ][, array<string|int, mixed>|string|null $values = NULL ][, string|FieldDefinitionInterface|null $typeOrDefinition = NULL ][, TypedDataInterface $parent = NULL ][, bool|null $isBaseField = NULL ][, array<string|int, mixed>|null $mockMethods = NULL ]) : FieldItemListInterface
Parameters
- $name : string|null = NULL
-
The field name.
- $values : array<string|int, mixed>|string|null = NULL
-
The field values.
- $typeOrDefinition : string|FieldDefinitionInterface|null = NULL
-
A field type like 'string', 'integer', 'boolean'. Or a path to a field class like Drupal\Core\Field\Plugin\Field\FieldType\IntegerItem. Or a ready definition object to use. If null - will be created a stub with fallback ItemStubItem definition.
- $parent : TypedDataInterface = NULL
-
Parent item for attaching to the field.
- $isBaseField : bool|null = NULL
-
A flag to create a base field instance.
- $mockMethods : array<string|int, mixed>|null = NULL
-
A list of method to mock when creating the instance.
Return values
FieldItemListInterface —A field item list with items as stubs.
createFieldItemDefinitionStub()
Creates a field definition stub.
public
static createFieldItemDefinitionStub([string $class = NULL ][, array<string|int, mixed> $settings = NULL ][, bool $isBaseField = NULL ]) : FieldDefinitionInterface
Parameters
- $class : string = NULL
-
Field class.
- $settings : array<string|int, mixed> = NULL
-
Field settings.
- $isBaseField : bool = NULL
-
A flag to create a base field instance.
Return values
FieldDefinitionInterface —A field field definition stub.