function FieldFormatterSettingsDefaults::numberSettings
Same name in other branches
- 9 core/modules/field/src/Plugin/migrate/process/d6/FieldFormatterSettingsDefaults.php \Drupal\field\Plugin\migrate\process\d6\FieldFormatterSettingsDefaults::numberSettings()
- 8.9.x core/modules/field/src/Plugin/migrate/process/d6/FieldFormatterSettingsDefaults.php \Drupal\field\Plugin\migrate\process\d6\FieldFormatterSettingsDefaults::numberSettings()
- 10 core/modules/field/src/Plugin/migrate/process/d6/FieldFormatterSettingsDefaults.php \Drupal\field\Plugin\migrate\process\d6\FieldFormatterSettingsDefaults::numberSettings()
Parameters
string $type: The field type.
$format: The format selected for the field on the display.
Return value
array The correct default settings.
Throws
\Drupal\migrate\MigrateException
1 call to FieldFormatterSettingsDefaults::numberSettings()
- FieldFormatterSettingsDefaults::transform in core/
modules/ field/ src/ Plugin/ migrate/ process/ d6/ FieldFormatterSettingsDefaults.php - Set field formatter settings when the map didn't map: for date formatters, the fallback format, for everything else, empty array.
File
-
core/
modules/ field/ src/ Plugin/ migrate/ process/ d6/ FieldFormatterSettingsDefaults.php, line 53
Class
- FieldFormatterSettingsDefaults
- Set the default field settings.
Namespace
Drupal\field\Plugin\migrate\process\d6Code
protected function numberSettings($type, $format) {
$map = [
'number_decimal' => [
'us_0' => [
'scale' => 0,
'decimal_separator' => '.',
'thousand_separator' => ',',
'prefix_suffix' => TRUE,
],
'us_1' => [
'scale' => 1,
'decimal_separator' => '.',
'thousand_separator' => ',',
'prefix_suffix' => TRUE,
],
'us_2' => [
'scale' => 2,
'decimal_separator' => '.',
'thousand_separator' => ',',
'prefix_suffix' => TRUE,
],
'be_0' => [
'scale' => 0,
'decimal_separator' => ',',
'thousand_separator' => '.',
'prefix_suffix' => TRUE,
],
'be_1' => [
'scale' => 1,
'decimal_separator' => ',',
'thousand_separator' => '.',
'prefix_suffix' => TRUE,
],
'be_2' => [
'scale' => 2,
'decimal_separator' => ',',
'thousand_separator' => '.',
'prefix_suffix' => TRUE,
],
'fr_0' => [
'scale' => 0,
'decimal_separator' => ',',
'thousand_separator' => ' ',
'prefix_suffix' => TRUE,
],
'fr_1' => [
'scale' => 1,
'decimal_separator' => ',',
'thousand_separator' => ' ',
'prefix_suffix' => TRUE,
],
'fr_2' => [
'scale' => 2,
'decimal_separator' => ',',
'thousand_separator' => ' ',
'prefix_suffix' => TRUE,
],
],
'number_integer' => [
'us_0' => [
'thousand_separator' => ',',
'prefix_suffix' => TRUE,
],
'be_0' => [
'thousand_separator' => '.',
'prefix_suffix' => TRUE,
],
'fr_0' => [
'thousand_separator' => ' ',
'prefix_suffix' => TRUE,
],
],
];
return $map[$type][$format] ?? [];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.