You are here

protected function FieldInstanceSettings::convertSizeUnit in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/field/src/Plugin/migrate/process/d6/FieldInstanceSettings.php \Drupal\field\Plugin\migrate\process\d6\FieldInstanceSettings::convertSizeUnit()

Convert file size strings into their D8 format.

D6 stores file size using a "K" for kilobytes and "M" for megabytes where as D8 uses "KB" and "MB" respectively.

Parameters

string $size_string: The size string, eg 10M

Return value

string The D8 version of the size string.

1 call to FieldInstanceSettings::convertSizeUnit()
FieldInstanceSettings::transform in core/modules/field/src/Plugin/migrate/process/d6/FieldInstanceSettings.php
Set the field instance defaults.

File

core/modules/field/src/Plugin/migrate/process/d6/FieldInstanceSettings.php, line 80
Contains \Drupal\field\Plugin\migrate\process\d6\FieldInstanceSettings.

Class

FieldInstanceSettings
Plugin annotation @MigrateProcessPlugin( id = "d6_field_field_settings" )

Namespace

Drupal\field\Plugin\migrate\process\d6

Code

protected function convertSizeUnit($size_string) {
  $size_unit = substr($size_string, strlen($size_string) - 1);
  if ($size_unit == "M" || $size_unit == "K") {
    return $size_string . "B";
  }
  return $size_string;
}