Same name and namespace in other branches
  1. 8.9.x core/modules/user/src/Plugin/migrate/process/UserUpdate8002.php \Drupal\user\Plugin\migrate\process\UserUpdate8002
  2. 9 core/modules/user/src/Plugin/migrate/process/UserUpdate8002.php \Drupal\user\Plugin\migrate\process\UserUpdate8002

Keep the predefined roles for rid 1 and 2.

Plugin annotation


@MigrateProcessPlugin(
  id = "user_update_8002"
)

Hierarchy

  • class \Drupal\user\Plugin\migrate\process\UserUpdate8002 extends \Drupal\migrate\ProcessPluginBase

Expanded class hierarchy of UserUpdate8002

File

core/modules/user/src/Plugin/migrate/process/UserUpdate8002.php, line 16

Namespace

Drupal\user\Plugin\migrate\process
View source
class UserUpdate8002 extends ProcessPluginBase {

  /**
   * {@inheritdoc}
   *
   * Keep the predefined roles for rid 1 and 2.
   */
  public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
    $rid = $row
      ->getSourceProperty('rid');
    $map = [
      1 => 'anonymous',
      2 => 'authenticated',
    ];
    return $map[$rid] ?? $value;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
UserUpdate8002::transform public function Keep the predefined roles for rid 1 and 2.