diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/NumericFormatterBase.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/NumericFormatterBase.php index c30a9d2..e219c01 100644 --- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/NumericFormatterBase.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/NumericFormatterBase.php @@ -75,10 +75,8 @@ public function viewElements(FieldItemListInterface $items) { // Account for prefix and suffix. if ($this->getSetting('prefix_suffix')) { - $prefixes = isset($settings['prefix']) ? array_map(array($this, 'fieldFilterXss'), explode('|', $settings['prefix'])) : array(''); - $suffixes = isset($settings['suffix']) ? array_map(array($this, 'fieldFilterXss'), explode('|', $settings['suffix'])) : array(''); - $prefix = (count($prefixes) > 1) ? $this->formatPlural($item->value, $prefixes[0], $prefixes[1]) : $prefixes[0]; - $suffix = (count($suffixes) > 1) ? $this->formatPlural($item->value, $suffixes[0], $suffixes[1]) : $suffixes[0]; + $prefix = isset($settings['prefix']) ? $settings['prefix'] : ''; + $suffix = isset($settings['suffix']) ? $settings['suffix'] : ''; $output = $prefix . $output . $suffix; } // Output the raw value in a content attribute if the text of the HTML diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/NumericItemBase.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/NumericItemBase.php index 9f9bd0b..377f88f 100644 --- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/NumericItemBase.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/NumericItemBase.php @@ -51,14 +51,14 @@ public function fieldSettingsForm(array $form, FormStateInterface $form_state) { '#title' => t('Prefix'), '#default_value' => $settings['prefix'], '#size' => 60, - '#description' => t("Define a string that should be prefixed to the value, like '$ ' or '€ '. Leave blank for none. Separate singular and plural values with a pipe ('pound|pounds')."), + '#description' => t("Define a string that should be prefixed to the value, like '$ ' or '€ '. Leave blank for none."), ); $element['suffix'] = array( '#type' => 'textfield', '#title' => t('Suffix'), '#default_value' => $settings['suffix'], '#size' => 60, - '#description' => t("Define a string that should be suffixed to the value, like ' m', ' kb/s'. Leave blank for none. Separate singular and plural values with a pipe ('pound|pounds')."), + '#description' => t("Define a string that should be suffixed to the value, like ' m', ' kb/s'. Leave blank for none."), ); return $element; diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/NumberWidget.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/NumberWidget.php index 50f8006..86db983 100644 --- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/NumberWidget.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/NumberWidget.php @@ -100,12 +100,10 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen // Add prefix and suffix. if ($field_settings['prefix']) { - $prefixes = explode('|', $field_settings['prefix']); - $element['#field_prefix'] = $this->fieldFilterXss(array_pop($prefixes)); + $element['#field_prefix'] = $this->fieldFilterXss($field_settings['prefix']); } if ($field_settings['suffix']) { - $suffixes = explode('|', $field_settings['suffix']); - $element['#field_suffix'] = $this->fieldFilterXss(array_pop($suffixes)); + $element['#field_suffix'] = $this->fieldFilterXss($field_settings['suffix']); } return array('value' => $element);