class PhoneNumberSettings in SMS Framework 8
Same name in this branch
- 8 src/Entity/PhoneNumberSettings.php \Drupal\sms\Entity\PhoneNumberSettings
- 8 src/Plugin/migrate/process/PhoneNumberSettings.php \Drupal\sms\Plugin\migrate\process\PhoneNumberSettings
- 8 src/Plugin/migrate/destination/PhoneNumberSettings.php \Drupal\sms\Plugin\migrate\destination\PhoneNumberSettings
Same name and namespace in other branches
- 2.x src/Plugin/migrate/process/PhoneNumberSettings.php \Drupal\sms\Plugin\migrate\process\PhoneNumberSettings
- 2.1.x src/Plugin/migrate/process/PhoneNumberSettings.php \Drupal\sms\Plugin\migrate\process\PhoneNumberSettings
Creates phone number settings for new D8 site based on D6/D7 settings.
Plugin annotation
@MigrateProcessPlugin(
id = "phone_number_settings"
)
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\sms\Plugin\migrate\process\PhoneNumberSettings
- class \Drupal\migrate\ProcessPluginBase implements MigrateProcessInterface
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, MessengerTrait, StringTranslationTrait
Expanded class hierarchy of PhoneNumberSettings
File
- src/
Plugin/ migrate/ process/ PhoneNumberSettings.php, line 16
Namespace
Drupal\sms\Plugin\migrate\processView source
class PhoneNumberSettings extends ProcessPluginBase {
const DEFAULT_D7_VERIFICATION_MESSAGE = '[site:name] confirmation code: ';
const DEFAULT_D6_VERIFICATION_MESSAGE = '[site-name] confirmation code: [confirm-code]';
const DEFAULT_VERIFICATION_MESSAGE = "Your verification code is '[sms-message:verification-code]'.\nGo to [sms:verification-url] to verify your phone number.\n- [site:name]";
/**
* {@inheritdoc}
*/
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
if ($row
->getSourceProperty('id') === 'sms_user_confirmation_message') {
// If still using the D6/D7 default message, swap for the new D8 default.
if (empty($value) || $value == static::DEFAULT_D6_VERIFICATION_MESSAGE || $value == static::DEFAULT_D7_VERIFICATION_MESSAGE) {
$value = static::DEFAULT_VERIFICATION_MESSAGE;
}
else {
// Replace both D6 and D7 message token formats.
$value = str_replace('[site-name]', '[site:name]', $value);
$value = str_replace('[confirm-code]', '[sms-message:verification-code]', $value);
$value = str_replace('[confirm:code]', '[sms-message:verification-code]', $value);
}
}
return $value;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DependencySerializationTrait:: |
protected | property | An array of entity type IDs keyed by the property name of their storages. | |
DependencySerializationTrait:: |
protected | property | An array of service IDs keyed by property name used for serialization. | |
DependencySerializationTrait:: |
public | function | 1 | |
DependencySerializationTrait:: |
public | function | 2 | |
MessengerTrait:: |
protected | property | The messenger. | 29 |
MessengerTrait:: |
public | function | Gets the messenger. | 29 |
MessengerTrait:: |
public | function | Sets the messenger. | |
PhoneNumberSettings:: |
constant | |||
PhoneNumberSettings:: |
constant | |||
PhoneNumberSettings:: |
constant | |||
PhoneNumberSettings:: |
public | function |
Performs the associated process. Overrides ProcessPluginBase:: |
|
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:: |
3 |
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. | 92 |
ProcessPluginBase:: |
public | function |
Indicates whether the returned value requires multiple handling. Overrides MigrateProcessInterface:: |
3 |
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
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. |