You are here

public function PhoneNumberSettings::import in SMS Framework 2.x

Same name and namespace in other branches
  1. 8 src/Plugin/migrate/destination/PhoneNumberSettings.php \Drupal\sms\Plugin\migrate\destination\PhoneNumberSettings::import()
  2. 2.1.x src/Plugin/migrate/destination/PhoneNumberSettings.php \Drupal\sms\Plugin\migrate\destination\PhoneNumberSettings::import()

Import the row.

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

Parameters

\Drupal\migrate\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.

Overrides EntityConfigBase::import

File

src/Plugin/migrate/destination/PhoneNumberSettings.php, line 26

Class

PhoneNumberSettings
Destination plugin for SMS phone number verifications.

Namespace

Drupal\sms\Plugin\migrate\destination

Code

public function import(Row $row, array $old_destination_id_values = []) {
  $return = parent::import($row, $old_destination_id_values);
  if ($return) {

    // After successful import of the phone_number_setting, the phone number
    // field should be created and attached to the user entity type.

    /** @var \Drupal\sms\Entity\PhoneNumberSettingsInterface $phone_number_setting */
    $phone_number_setting = $this->storage
      ->load(reset($return));
    $this
      ->createPhoneNumberField($phone_number_setting);
  }
  return $return;
}