final class FieldCreateCommand extends Command (View source)

Create a new field.

Traits

A copy of \Drupal\Core\DependencyInjection\AutowireTrait with first params' type hint changed.

Stores input, output and IO objects for easy access in commands.

Constants

NAME

Properties

protected InputInterface $input from  IoTrait
EntityTypeBundleInfoInterface $entityTypeBundleInfo from  EntityTypeBundleAskTrait
EntityTypeManagerInterface $entityTypeManager from  EntityTypeBundleValidationTrait
protected OutputInterface $output from  IoTrait
protected DrushStyle $io from  IoTrait

Methods

array
getFieldableEntityTypes()

No description

string|null
askEntityType()

No description

string|null
askBundle()

No description

void
validateEntityType(string $entityTypeId)

No description

void
validateBundle(string $entityTypeId, string $bundle)

No description

static AutowireTrait
create(ContainerInterface $container)

Instantiates a new instance of the implementing class using autowiring.

DrushStyle
setIo(InputInterface $input, OutputInterface $output)

No description

from  IoTrait
DrushStyle
io()

No description

from  IoTrait
InputInterface
input()

No description

from  IoTrait
OutputInterface
output()

No description

from  IoTrait
void
ensureIo()

No description

from  IoTrait
__construct(FieldTypePluginManagerInterface $fieldTypePluginManager, WidgetPluginManager $widgetPluginManager, EntityTypeManagerInterface $entityTypeManager, EntityTypeBundleInfoInterface $entityTypeBundleInfo, ModuleHandlerInterface $moduleHandler, EntityFieldManagerInterface $entityFieldManager, EventDispatcherInterface $eventDispatcher, ContentTranslationManagerInterface|null $contentTranslationManager = null)

No description

void
configure()

No description

int
execute(InputInterface $input, OutputInterface $output)

No description

void
complete(CompletionInput $input, CompletionSuggestions $suggestions)

No description

string|null
askExistingFieldName()

No description

string
askFieldName()

No description

string
askFieldLabel()

No description

string|null
askFieldDescription()

No description

string
askFieldType()

No description

string|null
askFieldWidget()

No description

bool
askRequired()

No description

bool
askTranslatable()

No description

int
askCardinality()

No description

FieldConfigInterface
createField()

No description

FieldStorageConfigInterface
createFieldStorage()

No description

void
createFieldDisplay(string $context)

No description

EntityDisplayInterface|null
getEntityDisplay(string $context)

No description

void
logResult(FieldConfigInterface $field)

No description

string
generateFieldName(string $source, string $bundle)

No description

bool
fieldExists(string $fieldName, string $entityType, string $bundle)

No description

bool
fieldStorageExists(string $fieldName, string $entityType)

No description

array
getExistingFieldStorageOptions(string $entityType, string $bundle, bool $showMachineNames)

No description

bool
hasContentTranslation()

No description

void
ensureOption(string $name, callable $asker, bool $required)

No description

FieldDefinitionInterface|null
getExistingFieldForDefaults()

No description

EntityDisplayInterface|null
getExistingEntityDisplayForDefaults(string $context)

No description

string|null
getExistingBundleForDefaults()

No description

Details

protected array getFieldableEntityTypes()

No description

Return Value

array

protected string|null askEntityType()

No description

Return Value

string|null

protected string|null askBundle()

No description

Return Value

string|null

protected void validateEntityType(string $entityTypeId)

No description

Parameters

string $entityTypeId

Return Value

void

protected void validateBundle(string $entityTypeId, string $bundle)

No description

Parameters

string $entityTypeId
string $bundle

Return Value

void

static AutowireTrait create(ContainerInterface $container)

Instantiates a new instance of the implementing class using autowiring.

Parameters

ContainerInterface $container

The service container this instance should use.

Return Value

AutowireTrait

DrushStyle setIo(InputInterface $input, OutputInterface $output)

No description

Parameters

InputInterface $input
OutputInterface $output

Return Value

DrushStyle

DrushStyle io()

No description

Return Value

DrushStyle

protected InputInterface input()

No description

Return Value

InputInterface

protected OutputInterface output()

No description

Return Value

OutputInterface

protected void ensureIo()

No description

Return Value

void

__construct(FieldTypePluginManagerInterface $fieldTypePluginManager, WidgetPluginManager $widgetPluginManager, EntityTypeManagerInterface $entityTypeManager, EntityTypeBundleInfoInterface $entityTypeBundleInfo, ModuleHandlerInterface $moduleHandler, EntityFieldManagerInterface $entityFieldManager, EventDispatcherInterface $eventDispatcher, ContentTranslationManagerInterface|null $contentTranslationManager = null)

No description

Parameters

FieldTypePluginManagerInterface $fieldTypePluginManager
WidgetPluginManager $widgetPluginManager
EntityTypeManagerInterface $entityTypeManager
EntityTypeBundleInfoInterface $entityTypeBundleInfo
ModuleHandlerInterface $moduleHandler
EntityFieldManagerInterface $entityFieldManager
EventDispatcherInterface $eventDispatcher
ContentTranslationManagerInterface|null $contentTranslationManager

protected void configure()

No description

Return Value

void

int execute(InputInterface $input, OutputInterface $output)

No description

Parameters

InputInterface $input
OutputInterface $output

Return Value

int

void complete(CompletionInput $input, CompletionSuggestions $suggestions)

No description

Parameters

CompletionInput $input
CompletionSuggestions $suggestions

Return Value

void

protected string|null askExistingFieldName()

No description

Return Value

string|null

protected string askFieldName()

No description

Return Value

string

protected string askFieldLabel()

No description

Return Value

string

protected string|null askFieldDescription()

No description

Return Value

string|null

protected string askFieldType()

No description

Return Value

string

protected string|null askFieldWidget()

No description

Return Value

string|null

protected bool askRequired()

No description

Return Value

bool

protected bool askTranslatable()

No description

Return Value

bool

protected int askCardinality()

No description

Return Value

int

protected FieldConfigInterface createField()

No description

Return Value

FieldConfigInterface

protected FieldStorageConfigInterface createFieldStorage()

No description

Return Value

FieldStorageConfigInterface

protected void createFieldDisplay(string $context)

No description

Parameters

string $context

Return Value

void

protected EntityDisplayInterface|null getEntityDisplay(string $context)

No description

Parameters

string $context

Return Value

EntityDisplayInterface|null

protected void logResult(FieldConfigInterface $field)

No description

Parameters

FieldConfigInterface $field

Return Value

void

protected string generateFieldName(string $source, string $bundle)

No description

Parameters

string $source
string $bundle

Return Value

string

protected bool fieldExists(string $fieldName, string $entityType, string $bundle)

No description

Parameters

string $fieldName
string $entityType
string $bundle

Return Value

bool

protected bool fieldStorageExists(string $fieldName, string $entityType)

No description

Parameters

string $fieldName
string $entityType

Return Value

bool

protected array getExistingFieldStorageOptions(string $entityType, string $bundle, bool $showMachineNames)

No description

Parameters

string $entityType
string $bundle
bool $showMachineNames

Return Value

array

protected bool hasContentTranslation()

No description

Return Value

bool

protected void ensureOption(string $name, callable $asker, bool $required)

No description

Parameters

string $name
callable $asker
bool $required

Return Value

void

protected FieldDefinitionInterface|null getExistingFieldForDefaults()

No description

Return Value

FieldDefinitionInterface|null

protected EntityDisplayInterface|null getExistingEntityDisplayForDefaults(string $context)

No description

Parameters

string $context

Return Value

EntityDisplayInterface|null

protected string|null getExistingBundleForDefaults()

No description

Return Value

string|null