public function ConvertBundlesForm::convertBundles in Convert Bundles 8
File
- src/
Form/ ConvertBundlesForm.php, line 205
Class
- ConvertBundlesForm
- ConvertBundlesForm.
Namespace
Drupal\convert_bundles\FormCode
public function convertBundles() {
$base_table_names = ConvertBundles::getBaseTableNames($this->entityType);
$userInput = ConvertBundles::sortUserInput($this->userInput, $this->fieldsNewTo, $this->fieldsFrom);
$map_fields = $userInput['map_fields'];
$update_fields = $userInput['update_fields'];
$field_table_names = ConvertBundles::getFieldTableNames($this->entityType, $this->fieldsFrom);
$ids = array_keys($this->entities);
$limit = 100;
$batch = [
'title' => $this
->t('Converting Base Tables...'),
'operations' => [
[
'\\Drupal\\convert_bundles\\ConvertBundles::convertBaseTables',
[
$this->entityType,
$base_table_names,
$ids,
$this->toType,
],
],
[
'\\Drupal\\convert_bundles\\ConvertBundles::convertFieldTables',
[
$field_table_names,
$ids,
$this->toType,
$update_fields,
],
],
[
'\\Drupal\\convert_bundles\\ConvertBundles::addNewFields',
[
$this->entityType,
$ids,
$limit,
$map_fields,
$this->fieldsTo,
$this->entities,
],
],
],
'finished' => '\\Drupal\\convert_bundles\\ConvertBundles::ConvertBundlesFinishedCallback',
];
batch_set($batch);
$this->tempStoreFactory
->get('convert_bundles_ids')
->delete($this->currentUser);
return 'Selected entities of type ' . implode(', ', $this->fromType) . ' were converted to ' . $this->toType;
}