You are here

public function Gauth::prepareRow in Google API PHP Client 8.3

Same name and namespace in other branches
  1. 8.4 src/Plugin/migrate/source/Gauth.php \Drupal\google_api_client\Plugin\migrate\source\Gauth::prepareRow()
  2. 8.2 src/Plugin/migrate/source/Gauth.php \Drupal\google_api_client\Plugin\migrate\source\Gauth::prepareRow()

Adds additional data to the row.

Parameters

\Drupal\migrate\Row $row: The row object.

Return value

bool FALSE if this row needs to be skipped.

Overrides SourcePluginBase::prepareRow

File

src/Plugin/migrate/source/Gauth.php, line 53

Class

Gauth
Drupal 7 user source from database.

Namespace

Drupal\google_api_client\Plugin\migrate\source

Code

public function prepareRow(Row $row) {
  $services = $row
    ->getSourceProperty('services');
  $services = explode(',', $services);
  $row
    ->setSourceProperty('services', $services);
  $all_scopes = google_api_client_google_services_scopes($services);
  $merged_scopes = [];
  foreach ($all_scopes as $scopes) {
    $merged_scopes = array_merge($merged_scopes, array_keys($scopes));
  }
  $row
    ->setSourceProperty('service_scopes', $merged_scopes);
  $access_type = $row
    ->getSourceProperty('access_type');
  $row
    ->setSourceProperty('access_type', $access_type == 'offline');
  return parent::prepareRow($row);
}