class CommerceAttributeHandlerSetting in Commerce Migrate 3.0.x
Same name and namespace in other branches
- 8.2 modules/commerce/src/Plugin/migrate/process/commerce1/CommerceAttributeHandlerSetting.php \Drupal\commerce_migrate_commerce\Plugin\migrate\process\commerce1\CommerceAttributeHandlerSetting
- 3.1.x modules/commerce/src/Plugin/migrate/process/commerce1/CommerceAttributeHandlerSetting.php \Drupal\commerce_migrate_commerce\Plugin\migrate\process\commerce1\CommerceAttributeHandlerSetting
Adjusts the fields settings for attributes.
Plugin annotation
@MigrateProcessPlugin(
id = "commerce1_attribute_handler_setting"
)
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, MessengerTrait, StringTranslationTrait
- class \Drupal\migrate\ProcessPluginBase implements MigrateProcessInterface
- class \Drupal\commerce_migrate_commerce\Plugin\migrate\process\commerce1\CommerceAttributeHandlerSetting
- class \Drupal\migrate\ProcessPluginBase implements MigrateProcessInterface
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, MessengerTrait, StringTranslationTrait
Expanded class hierarchy of CommerceAttributeHandlerSetting
1 file declares its use of CommerceAttributeHandlerSetting
- CommerceAttributeHandlerSettingTest.php in modules/
commerce/ tests/ src/ Unit/ Plugin/ migrate/ process/ commerce1/ CommerceAttributeHandlerSettingTest.php
File
- modules/
commerce/ src/ Plugin/ migrate/ process/ commerce1/ CommerceAttributeHandlerSetting.php, line 17
Namespace
Drupal\commerce_migrate_commerce\Plugin\migrate\process\commerce1View source
class CommerceAttributeHandlerSetting extends ProcessPluginBase {
/**
* {@inheritdoc}
*/
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
// If this is an attribute field, add the handler_settings.
if ('commerce_product' === $row
->getSourceProperty('entity_type') && 'taxonomy_term_reference' === $row
->getSourceProperty('type') && 'options_select' === $row
->getSourceProperty('widget')['type']) {
$new_handler_settings['target_bundles'][] = $row
->getSourceProperty('bundle');
$settings = $row
->getDestinationProperty('settings');
$handler_settings = isset($settings['handler_settings']) ? $settings['handler_settings'] : [];
return array_merge($handler_settings, $new_handler_settings);
}
else {
throw new MigrateSkipProcessException();
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CommerceAttributeHandlerSetting:: |
public | function |
Performs the associated process. Overrides ProcessPluginBase:: |
|
DependencySerializationTrait:: |
protected | property | ||
DependencySerializationTrait:: |
protected | property | ||
DependencySerializationTrait:: |
public | function | 2 | |
DependencySerializationTrait:: |
public | function | 2 | |
MessengerTrait:: |
protected | property | The messenger. | 27 |
MessengerTrait:: |
public | function | Gets the messenger. | 27 |
MessengerTrait:: |
public | function | Sets the messenger. | |
PluginBase:: |
protected | property | Configuration information passed into the plugin. | 1 |
PluginBase:: |
protected | property | The plugin implementation definition. | 1 |
PluginBase:: |
protected | property | The plugin_id. | |
PluginBase:: |
constant | A string which is used to separate base plugin IDs from the derivative ID. | ||
PluginBase:: |
public | function |
Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the definition of the plugin implementation. Overrides PluginInspectionInterface:: |
2 |
PluginBase:: |
public | function |
Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function | Determines if the plugin is configurable. | |
PluginBase:: |
public | function | Constructs a \Drupal\Component\Plugin\PluginBase object. | 98 |
ProcessPluginBase:: |
public | function |
Indicates whether the returned value requires multiple handling. Overrides MigrateProcessInterface:: |
3 |
StringTranslationTrait:: |
protected | property | The string translation service. | 4 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |