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 b0f5eec..7d36998 100644 --- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/NumericFormatterBase.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/NumericFormatterBase.php @@ -77,15 +77,16 @@ public function settingsForm(array $form, FormStateInterface $form_state) { ), ); - // @todo This field needs to have some kind of #states magic so that it - // only shows if the option on format_plural is - // NumericFormatterBase::FORMAT_PLURAL_USE_FORMATTER_SETTING. - // Need to do this before this patch is finalized! - $elements['format_plural_values'] = array( + $elements['format_plural_values'] = [ '#type' => 'fieldset', '#title' => $this->t('Prefix/suffix override'), '#after_build' => [[get_class($this), 'formatPluralValuesAfterBuild']], - ); + '#states' => [ + 'visible' => [ + ':input[name*="format_plural"]' => ['value' => NumericFormatterBase::FORMAT_PLURAL_USE_FORMATTER_SETTING], + ], + ], + ]; $langcode = $this->getSetting('_settings_langcode'); $plurals = $this->getNumberOfPlurals($langcode);