class EntityImageStyle extends EntityConfigBase (View source)

Every migration that uses this destination must have an optional dependency on the d6_file migration to ensure it runs first.

Traits

Provides a trait for managing an object's dependencies.

The entity field definition trait.

Wrapper methods for \Drupal\Core\StringTranslation\TranslationInterface.

Provides dependency injection friendly methods for serialization.

Provides a trait for the messenger service.

Constants

DERIVATIVE_SEPARATOR

A string which is used to separate base plugin IDs from the derivative ID.

Properties

protected string $pluginId

The plugin_id.

from  PluginBase
protected array $pluginDefinition

The plugin implementation definition.

from  PluginBase
protected array $configuration

Configuration information passed into the plugin.

from  PluginBase
protected TranslationInterface $stringTranslation

The string translation service.

from  StringTranslationTrait
protected array $_serviceIds

An array of service IDs keyed by property name used for serialization.

from  DependencySerializationTrait
protected array $_entityStorages

An array of entity type IDs keyed by the property name of their storages.

from  DependencySerializationTrait
protected MessengerInterface $messenger

The messenger.

from  MessengerTrait
protected bool $supportsRollback

Indicates whether the destination can be rolled back.

from  DestinationBase
protected int $rollbackAction

The rollback action to be saved for the last imported item.

from  DestinationBase
protected MigrationInterface $migration

The migration.

from  DestinationBase
protected array $dependencies

The object's dependencies.

from  DependencyTrait
protected EntityStorageInterface $storage

The entity storage.

from  Entity
protected array $bundles

The list of the bundles of this entity type.

from  Entity
protected LanguageManagerInterface $languageManager

The language manager.

from  EntityConfigBase
protected ConfigFactoryInterface $configFactory

The configuration factory.

from  EntityConfigBase

Methods

__construct(array $configuration, string $plugin_id, mixed $plugin_definition, MigrationInterface $migration, EntityStorageInterface $storage, array $bundles, LanguageManagerInterface $language_manager, ConfigFactoryInterface $config_factory)

Construct a new entity.

string
getPluginId()

Gets the plugin_id of the plugin instance.

string
getBaseId()

Gets the base_plugin_id of the plugin instance.

string|null
getDerivativeId()

Gets the derivative_id of the plugin instance.

array
getPluginDefinition()

Gets the definition of the plugin implementation.

bool
isConfigurable()

Determines if the plugin is configurable.

t(string $string, array $args = [], array $options = [])

Translates a string to the current language or to a given language.

formatPlural($count, $singular, $plural, array $args = [], array $options = [])

Formats a string containing a count of items.

getNumberOfPlurals($langcode = NULL)

Returns the number of plurals supported by a given language.

getStringTranslation()

Gets the string translation service.

$this
setStringTranslation(TranslationInterface $translation)

Sets the string translation service to use.

__sleep()

{@inheritdoc}

__wakeup()

{@inheritdoc}

setMessenger(MessengerInterface $messenger)

Sets the messenger.

messenger()

Gets the messenger.

int
rollbackAction()

The rollback action for the last imported item.

checkRequirements()

Checks if requirements for this plugin are OK.

rollback(array $destination_identifier)

Delete the specified destination object from the target Drupal.

bool
supportsRollback()

Whether the destination can be rolled back or not.

setRollbackAction(array $id_map, int $update_action = MigrateIdMapInterface::ROLLBACK_PRESERVE)

For a destination item being updated, set the appropriate rollback action.

string|null
getDestinationModule()

Gets the destination module handling the destination data.

$this
addDependency(string $type, string $name)

Adds a dependency.

addDependencies(array $dependencies)

Adds multiple dependencies.

array
getDefinitionFromEntity(string $key)

Gets the field definition from a specific entity base field.

static string
getEntityTypeId(string $plugin_id)

Finds the entity type from configuration or plugin ID.

create(ContainerInterface $container, array $configuration, string $plugin_id, mixed $plugin_definition, MigrationInterface $migration = NULL)

Creates an instance of the plugin.

string
getBundle(Row $row)

Gets the bundle for the row taking into account the default.

from  Entity
array
fields()

Returns an array of destination fields.

from  Entity
getEntity(Row $row, array $old_destination_id_values)

Creates or loads an entity.

from  Entity
string
getEntityId(Row $row)

Gets the entity ID of the row.

from  Entity
string|bool
getKey(string $key)

Returns a specific entity key.

from  Entity
array
calculateDependencies()

Calculates dependencies for the configured plugin.

from  Entity
array|bool
import(Row $row, array $old_destination_id_values = [])

Import the row.

bool
isTranslationDestination()

Get whether this destination is for translations.

array[]
getIds()

Gets the destination IDs.

updateEntity(EntityInterface $entity, Row $row)

Updates an entity with the contents of a row.

updateEntityProperty(EntityInterface $entity, array $parents, string|object $value)

Updates a (possible nested) entity property with a value.

string
generateId(Row $row, array $ids)

Generates an entity ID.

Details

__construct(array $configuration, string $plugin_id, mixed $plugin_definition, MigrationInterface $migration, EntityStorageInterface $storage, array $bundles, LanguageManagerInterface $language_manager, ConfigFactoryInterface $config_factory)

Construct a new entity.

Parameters

array $configuration

A configuration array containing information about the plugin instance.

string $plugin_id

The plugin_id for the plugin instance.

mixed $plugin_definition

The plugin implementation definition.

MigrationInterface $migration

The migration.

EntityStorageInterface $storage

The storage for this entity type.

array $bundles

The list of bundles this entity type has.

LanguageManagerInterface $language_manager

The language manager.

ConfigFactoryInterface $config_factory

The configuration factory.

string getPluginId()

Gets the plugin_id of the plugin instance.

Return Value

string

The plugin_id of the plugin instance.

string getBaseId()

Gets the base_plugin_id of the plugin instance.

Return Value

string

The base_plugin_id of the plugin instance.

string|null getDerivativeId()

Gets the derivative_id of the plugin instance.

Return Value

string|null

The derivative_id of the plugin instance NULL otherwise.

array getPluginDefinition()

Gets the definition of the plugin implementation.

Return Value

array

The plugin definition, as returned by the discovery object used by the plugin manager.

bool isConfigurable()

Determines if the plugin is configurable.

Return Value

bool

A boolean indicating whether the plugin is configurable.

protected TranslatableMarkup t(string $string, array $args = [], array $options = [])

Translates a string to the current language or to a given language.

See \Drupal\Core\StringTranslation\TranslatableMarkup::__construct() for important security information and usage guidelines.

In order for strings to be localized, make them available in one of the ways supported by the

Parameters

string $string

A string containing the English text to translate.

array $args

(optional) An associative array of replacements to make after translation. Based on the first character of the key, the value is escaped and/or themed. See \Drupal\Component\Render\FormattableMarkup::placeholderFormat() for details.

array $options

(optional) An associative array of additional options, with the following elements:

  • 'langcode' (defaults to the current language): A language code, to translate to a language other than what is used to display the page.
  • 'context' (defaults to the empty context): The context the source string belongs to. See the @link i18n Internationalization topic @endlink for more information about string contexts.

Return Value

TranslatableMarkup

An object that, when cast to a string, returns the translated string.

See also

FormattableMarkup::placeholderFormat
TranslatableMarkup::__construct

protected formatPlural($count, $singular, $plural, array $args = [], array $options = [])

Formats a string containing a count of items.

Parameters

$count
$singular
$plural
array $args
array $options

See also

TranslationInterface::formatPlural

protected getNumberOfPlurals($langcode = NULL)

Returns the number of plurals supported by a given language.

Parameters

$langcode

See also

PluralFormulaInterface::getNumberOfPlurals

protected TranslationInterface getStringTranslation()

Gets the string translation service.

Return Value

TranslationInterface

The string translation service.

$this setStringTranslation(TranslationInterface $translation)

Sets the string translation service to use.

Parameters

TranslationInterface $translation

The string translation service.

Return Value

$this

__sleep()

{@inheritdoc}

__wakeup()

{@inheritdoc}

setMessenger(MessengerInterface $messenger)

Sets the messenger.

Parameters

MessengerInterface $messenger

The messenger.

MessengerInterface messenger()

Gets the messenger.

Return Value

MessengerInterface

The messenger.

int rollbackAction()

The rollback action for the last imported item.

Return Value

int

The MigrateIdMapInterface::ROLLBACK_ constant indicating how an imported item should be handled on rollback.

checkRequirements()

Checks if requirements for this plugin are OK.

rollback(array $destination_identifier)

Delete the specified destination object from the target Drupal.

Parameters

array $destination_identifier

The ID of the destination object to delete.

bool supportsRollback()

Whether the destination can be rolled back or not.

Return Value

bool

TRUE if rollback is supported, FALSE if not.

protected setRollbackAction(array $id_map, int $update_action = MigrateIdMapInterface::ROLLBACK_PRESERVE)

For a destination item being updated, set the appropriate rollback action.

Parameters

array $id_map

The map row data for the item.

int $update_action

The rollback action to take if we are updating an existing item.

string|null getDestinationModule()

Gets the destination module handling the destination data.

Return Value

string|null

The destination module or NULL if not found.

protected $this addDependency(string $type, string $name)

Adds a dependency.

Parameters

string $type

Type of dependency being added: 'module', 'theme', 'config', 'content'.

string $name

If $type is 'module' or 'theme', the name of the module or theme. If $type is 'config' or 'content', the result of EntityInterface::getConfigDependencyName().

Return Value

$this

See also

EntityInterface::getConfigDependencyName

protected addDependencies(array $dependencies)

Adds multiple dependencies.

Parameters

array $dependencies

An array of dependencies keyed by the type of dependency. One example: @code array( 'module' => array( 'node', 'field', 'image', ), ); @endcode

See also

DependencyTrait::addDependency

protected array getDefinitionFromEntity(string $key)

Gets the field definition from a specific entity base field.

The method takes the field ID as an argument and returns the field storage definition to be used in getIds() by querying the destination entity base field definition.

Parameters

string $key

The field ID key.

Return Value

array

An associative array with a structure that contains the field type, keyed as 'type', together with field storage settings as they are returned by FieldStorageDefinitionInterface::getSettings().

See also

FieldStorageDefinitionInterface::getSettings

static protected string getEntityTypeId(string $plugin_id)

Finds the entity type from configuration or plugin ID.

Parameters

string $plugin_id

The plugin ID.

Return Value

string

The entity type.

static ContainerFactoryPluginInterface create(ContainerInterface $container, array $configuration, string $plugin_id, mixed $plugin_definition, MigrationInterface $migration = NULL)

Creates an instance of the plugin.

Parameters

ContainerInterface $container

The container to pull out services used in the plugin.

array $configuration

A configuration array containing information about the plugin instance.

string $plugin_id

The plugin ID for the plugin instance.

mixed $plugin_definition

The plugin implementation definition.

MigrationInterface $migration

Return Value

ContainerFactoryPluginInterface

Returns an instance of this plugin.

string getBundle(Row $row)

Gets the bundle for the row taking into account the default.

Parameters

Row $row

The current row we're importing.

Return Value

string

The bundle for this row.

array fields()

Returns an array of destination fields.

Derived classes must implement fields(), returning a list of available destination fields.

Return Value

array
  • Keys: machine names of the fields
  • Values: Human-friendly descriptions of the fields.

protected EntityInterface getEntity(Row $row, array $old_destination_id_values)

Creates or loads an entity.

Parameters

Row $row

The row object.

array $old_destination_id_values

The old destination IDs.

Return Value

EntityInterface

The entity we are importing into.

protected string getEntityId(Row $row)

Gets the entity ID of the row.

Parameters

Row $row

The row of data.

Return Value

string

The entity ID for the row that we are importing.

protected string|bool getKey(string $key)

Returns a specific entity key.

Parameters

string $key

The name of the entity key to return.

Return Value

string|bool

The entity key, or FALSE if it does not exist.

See also

EntityTypeInterface::getKeys

array calculateDependencies()

Calculates dependencies for the configured plugin.

Dependencies are saved in the plugin's configuration entity and are used to determine configuration synchronization order. For example, if the plugin integrates with specific user roles, this method should return an array of dependencies listing the specified roles.

Return Value

array

An array of dependencies grouped by type (config, content, module, theme). For example: @code array( 'config' => array('user.role.anonymous', 'user.role.authenticated'), 'content' => array('node:article:f0a189e6-55fb-47fb-8005-5bef81c44d6d'), 'module' => array('node', 'user'), 'theme' => array('seven'), ); @endcode

array|bool import(Row $row, array $old_destination_id_values = [])

Import the row.

Derived classes must implement import(), to construct one new object (pre-populated) using ID mappings in the Migration.

Parameters

Row $row

The row object.

array $old_destination_id_values

(optional) The old destination IDs. Defaults to an empty array.

Return Value

array|bool

An indexed array of destination IDs in the same order as defined in the plugin's getIds() method if the plugin wants to save the IDs to the ID map, TRUE to indicate success without saving IDs to the ID map, or FALSE to indicate a failure.

protected bool isTranslationDestination()

Get whether this destination is for translations.

Return Value

bool

Whether this destination is for translations.

array[] getIds()

Gets the destination IDs.

To support MigrateIdMap maps, derived destination classes should return field definition(s) corresponding to the primary key of the destination being implemented. These are used to construct the destination key fields of the map table for a migration using this destination.

Return Value

array[]

An associative array of field definitions keyed by field ID. Values are associative arrays with a structure that contains the field type ('type' key). The other keys are the field storage settings as they are returned by FieldStorageDefinitionInterface::getSettings(). As an example, for a composite destination primary key that is defined by an integer and a string, the returned value might look like: @code return [ 'id' => [ 'type' => 'integer', 'unsigned' => FALSE, 'size' => 'big', ], 'version' => [ 'type' => 'string', 'max_length' => 64, 'is_ascii' => TRUE, ], ]; @endcode If 'type' points to a field plugin with multiple columns and needs to refer to a column different than 'value', the key of that column will be appended as a suffix to the plugin name, separated by dot ('.'). Example: @code return [ 'format' => [ 'type' => 'text.format', ], ]; @endcode Additional custom keys/values, that are not part of field storage definition, can be passed in definitions: @code return [ 'nid' => [ 'type' => 'integer', 'custom_setting' => 'some_value', ], ]; @endcode

protected updateEntity(EntityInterface $entity, Row $row)

Updates an entity with the contents of a row.

Parameters

EntityInterface $entity

The entity to update.

Row $row

The row object to update from.

Exceptions

LogicException

protected updateEntityProperty(EntityInterface $entity, array $parents, string|object $value)

Updates a (possible nested) entity property with a value.

Parameters

EntityInterface $entity

The config entity.

array $parents

The array of parents.

string|object $value

The value to update to.

protected string generateId(Row $row, array $ids)

Generates an entity ID.

Parameters

Row $row

The current row.

array $ids

The destination IDs.

Return Value

string

The generated entity ID.