class UrlAlias
Legacy destination class for non-entity path aliases.
Plugin annotation
@MigrateDestination(
id = "url_alias"
)
Hierarchy
- class \Drupal\path\Plugin\migrate\destination\UrlAlias
Expanded class hierarchy of UrlAlias
Deprecated
in drupal:8.8.0 and is removed from drupal:9.0.0. Use the entity:path_alias destination instead.
See also
https://www.drupal.org/node/3013865
File
-
core/
modules/ path/ src/ Plugin/ migrate/ destination/ UrlAlias.php, line 22
Namespace
Drupal\path\Plugin\migrate\destinationView source
class UrlAlias extends EntityContentBase {
/**
* {@inheritdoc}
*/
public function import(Row $row, array $old_destination_id_values = []) {
if ($row->getDestinationProperty('source')) {
$row->setDestinationProperty('path', $row->getDestinationProperty('source'));
}
$path = $row->getDestinationProperty('path');
// Check if this alias is for a node and if that node is a translation.
if (preg_match('/^\\/node\\/\\d+$/', $path) && $row->hasDestinationProperty('node_translation')) {
// Replace the alias source with the translation source path.
$node_translation = $row->getDestinationProperty('node_translation');
$row->setDestinationProperty('path', '/node/' . $node_translation[0]);
$row->setDestinationProperty('langcode', $node_translation[1]);
}
return parent::import($row, $old_destination_id_values);
}
/**
* {@inheritdoc}
*/
protected static function getEntityTypeId($plugin_id) {
return 'path_alias';
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title | Overrides |
---|---|---|---|---|---|
DependencySerializationTrait::$_entityStorages | protected | property | An array of entity type IDs keyed by the property name of their storages. | ||
DependencySerializationTrait::$_serviceIds | protected | property | An array of service IDs keyed by property name used for serialization. | ||
DependencySerializationTrait::__sleep | public | function | 1 | ||
DependencySerializationTrait::__wakeup | public | function | 2 | ||
DependencyTrait::$dependencies | protected | property | The object's dependencies. | ||
DependencyTrait::addDependencies | protected | function | Adds multiple dependencies. | ||
DependencyTrait::addDependency | protected | function | Adds a dependency. | ||
DeprecatedServicePropertyTrait::__get | public | function | Allows to access deprecated/removed properties. | ||
MessengerTrait::$messenger | protected | property | The messenger. | 29 | |
MessengerTrait::messenger | public | function | Gets the messenger. | 29 | |
MessengerTrait::setMessenger | public | function | Sets the messenger. | ||
PluginBase::$configuration | protected | property | Configuration information passed into the plugin. | 1 | |
PluginBase::$pluginDefinition | protected | property | The plugin implementation definition. | 1 | |
PluginBase::$pluginId | protected | property | The plugin_id. | ||
PluginBase::DERIVATIVE_SEPARATOR | constant | A string which is used to separate base plugin IDs from the derivative ID. | |||
PluginBase::getBaseId | public | function | Gets the base_plugin_id of the plugin instance. | Overrides DerivativeInspectionInterface::getBaseId | |
PluginBase::getDerivativeId | public | function | Gets the derivative_id of the plugin instance. | Overrides DerivativeInspectionInterface::getDerivativeId | |
PluginBase::getPluginDefinition | public | function | Gets the definition of the plugin implementation. | Overrides PluginInspectionInterface::getPluginDefinition | 3 |
PluginBase::getPluginId | public | function | Gets the plugin_id of the plugin instance. | Overrides PluginInspectionInterface::getPluginId | |
PluginBase::isConfigurable | public | function | Determines if the plugin is configurable. | ||
StringTranslationTrait::$stringTranslation | protected | property | The string translation service. | 1 | |
StringTranslationTrait::formatPlural | protected | function | Formats a string containing a count of items. | ||
StringTranslationTrait::getNumberOfPlurals | protected | function | Returns the number of plurals supported by a given language. | ||
StringTranslationTrait::getStringTranslation | protected | function | Gets the string translation service. | ||
StringTranslationTrait::setStringTranslation | public | function | Sets the string translation service to use. | 2 | |
StringTranslationTrait::t | protected | function | Translates a string to the current language or to a given language. | ||
UrlAlias::getEntityTypeId | protected static | function | Finds the entity type from configuration or plugin ID. | ||
UrlAlias::import | public | function | Import the row. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.