TermEntityTranslation
class TermEntityTranslation extends FieldableEntity (View source)
Drupal 7 taxonomy term entity translation source plugin.
Available configuration keys:
- bundle: (optional) The taxonomy vocabulary (machine name) to filter terms retrieved from the source - can be a string or an array. If omitted, all terms are retrieved.
Examples:
Traits
Provides a trait for managing an object's dependencies.
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 ModuleHandlerInterface | $moduleHandler | The module handler service. |
from SourcePluginBase |
| protected MigrationInterface | $migration | The entity migration object. |
from SourcePluginBase |
| protected Row | $currentRow | The current row from the query. |
from SourcePluginBase |
| protected array | $currentSourceIds | The primary key of the current row. |
from SourcePluginBase |
| protected array | $highWaterProperty | Information on the property used as the high-water mark. |
from SourcePluginBase |
| protected KeyValueStoreInterface | $highWaterStorage | The key-value storage for the high-water value. |
from SourcePluginBase |
| protected int | $originalHighWater | The high water mark at the beginning of the import operation. |
from SourcePluginBase |
| protected bool | $cacheCounts | Whether this instance should cache the source count. |
from SourcePluginBase |
| protected string | $cacheKey | Key to use for caching counts. |
from SourcePluginBase |
| protected bool | $skipCount | Whether this instance should not attempt to count the source. |
from SourcePluginBase |
| protected bool | $trackChanges | Flags whether to track changes to incoming data. |
from SourcePluginBase |
| protected bool | $mapRowAdded | Flags whether source plugin will read the map row and add to data row. |
from SourcePluginBase |
| protected CacheBackendInterface | $cache | The backend cache. |
from SourcePluginBase |
| protected MigrateIdMapInterface | $idMap | The migration ID map. |
from SourcePluginBase |
| protected Iterator | $iterator | The iterator to iterate over the source rows. |
from SourcePluginBase |
| protected SelectInterface | $query | The query string. |
from SqlBase |
| protected Connection | $database | The database object. |
from SqlBase |
| protected StateInterface | $state | State service for retrieving database info. |
from SqlBase |
| protected int | $batch | The count of the number of batches run. |
from SqlBase |
| protected int | $batchSize | Number of records to fetch from the database during each batch. |
from SqlBase |
| protected array | $dependencies | The object's dependencies. |
from DependencyTrait |
| protected array | $systemData | The contents of the system table. |
from DrupalSqlBase |
| protected bool | $requirements | If the source provider is missing. |
from DrupalSqlBase |
| protected EntityTypeManagerInterface | $entityTypeManager | The entity type manager. |
from DrupalSqlBase |
Methods
Constructs a \Drupal\Component\Plugin\PluginBase object.
Translates a string to the current language or to a given language.
Formats a string containing a count of items.
Returns the number of plurals supported by a given language.
Gets the string translation service.
Returns the iterator that will yield the row arrays to be processed.
Get the high water storage object.
Get information on the property used as the high watermark.
Get the name of the field used as the high watermark.
Gets the source module providing the source data.
Creates an instance of the plugin.
Gets a connection to the referenced database.
No description
Retrieves all system data information from the source Drupal database.
Retrieves a module schema_version from the source Drupal database.
Checks if a given module is enabled in the source Drupal database.
Reads a variable from a source Drupal database.
Returns all non-deleted field instances attached to a specific entity type.
Retrieves field values for a single field of a single entity.
Checks if an entity type uses Entity Translation.
Gets an entity source language from the 'entity_translation' table.
Returns available fields on the source.
Defines the source fields uniquely identifying a source row.
Details
__construct(array $configuration, string $plugin_id, mixed $plugin_definition, MigrationInterface $migration, StateInterface $state, EntityTypeManagerInterface $entity_type_manager)
Constructs a \Drupal\Component\Plugin\PluginBase object.
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.
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
protected
formatPlural($count, $singular, $plural, array $args = [], array $options = [])
Formats a string containing a count of items.
protected
getNumberOfPlurals($langcode = NULL)
Returns the number of plurals supported by a given language.
protected TranslationInterface
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.
MessengerInterface
messenger()
Gets the messenger.
protected Iterator
initializeIterator()
Initializes the iterator with the source data.
protected ModuleHandlerInterface
getModuleHandler()
Gets the module handler.
bool
prepareRow(Row $row)
Adds additional data to the row.
protected Iterator
getIterator()
Returns the iterator that will yield the row arrays to be processed.
current()
{@inheritdoc}
key()
Gets the iterator key.
Implementation of \Iterator::key() - called when entering a loop iteration, returning the key of the current row. It must be a scalar - we will serialize to fulfill the requirement, but using getCurrentIds() is preferable.
valid()
Checks whether the iterator is currently valid.
Implementation of \Iterator::valid() - called at the top of the loop, returning TRUE to process the loop and FALSE to terminate it.
rewind()
Rewinds the iterator.
Implementation of \Iterator::rewind() - subclasses of SourcePluginBase should implement initializeIterator() to do any class-specific setup for iterating source records.
next()
{@inheritdoc}
protected
fetchNextRow()
Position the iterator to the following row.
protected bool
aboveHighWater(Row $row)
Check if the incoming data is newer than what we've previously imported.
protected bool
rowChanged(Row $row)
Checks if the incoming row has changed since our last import.
getCurrentIds()
Gets the currentSourceIds data member.
int
count(bool $refresh = FALSE)
Gets the source count.
Return a count of available source records, from the cache if appropriate. Returns MigrateSourceInterface::NOT_COUNTABLE if the source is not countable.
protected CacheBackendInterface
getCache()
Gets the cache object.
protected int
doCount()
Gets the source count using countQuery().
protected KeyValueStoreInterface
getHighWaterStorage()
Get the high water storage object.
protected int|null
getHighWater()
The current value of the high water mark.
The high water mark defines a timestamp stating the time the import was last run. If the mark is set, only content with a higher timestamp will be imported.
protected
saveHighWater(int $high_water)
Save the new high water mark.
protected array
getHighWaterProperty()
Get information on the property used as the high watermark.
Array of 'name' & (optional) db 'alias' properties used for high watermark.
protected string|null
getHighWaterField()
Get the name of the field used as the high watermark.
The name of the field qualified with an alias if available.
preRollback(MigrateRollbackEvent $event)
Performs pre-rollback tasks.
postRollback(MigrateRollbackEvent $event)
Performs post-rollback tasks.
string|null
getSourceModule()
Gets the source module providing the source data.
static ContainerFactoryPluginInterface
create(ContainerInterface $container, array $configuration, string $plugin_id, mixed $plugin_definition, MigrationInterface $migration = NULL)
Creates an instance of the plugin.
__toString()
Prints the query string when the object is used as a string.
Connection
getDatabase()
Gets the database connection object.
protected Connection
setUpDatabase(array $database_info)
Gets a connection to the referenced database.
This method will add the database connection if necessary.
checkRequirements()
Checks if requirements for this plugin are OK.
protected
select($table, $alias = NULL, array $options = [])
Wrapper for database select.
protected SelectInterface
prepareQuery()
Adds tags and metadata to the query.
protected
fetchNextBatch()
Prepares query for the next set of data from the source database.
SelectInterface
query()
No description
protected bool
mapJoinable()
Checks if we can join against the map table.
This function specifically catches issues when we're migrating with unique sets of credentials for the source and destination database.
protected $this
addDependency(string $type, string $name)
Adds a dependency.
protected
addDependencies(array $dependencies)
Adds multiple dependencies.
array
getSystemData()
Retrieves all system data information from the source Drupal database.
protected mixed
getModuleSchemaVersion(string $module)
Retrieves a module schema_version from the source Drupal database.
protected bool
moduleExists(string $module)
Checks if a given module is enabled in the source Drupal database.
protected mixed
variableGet($name, $default)
Reads a variable from a source Drupal database.
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.
protected array[]
getFields(string $entity_type, string|null $bundle = NULL)
Returns all non-deleted field instances attached to a specific entity type.
Typically, getFields() is used in the prepareRow method of a source plugin to get a list of all the field instances of the entity. A source plugin can then loop through the list of fields to do any other preparation before processing the row. Typically, a source plugin will use getFieldValues() to get the values of each field.
protected array
getFieldValues(string $entity_type, string $field, int $entity_id, int|null $revision_id = NULL, string $language = NULL)
Retrieves field values for a single field of a single entity.
Typically, getFieldValues() is used in the prepareRow method of a source plugin where the return values are placed on the row source.
protected bool
isEntityTranslatable(string $entity_type)
Checks if an entity type uses Entity Translation.
protected string|bool
getEntityTranslationSourceLanguage(string $entity_type, int $entity_id)
Gets an entity source language from the 'entity_translation' table.
array
fields()
Returns available fields on the source.
array[]
getIds()
Defines the source fields uniquely identifying a source row.
None of these fields should contain a NULL value. If necessary, use prepareRow() or hook_migrate_prepare_row() to rewrite NULL values to appropriate empty values (such as '' or 0).