diff --git a/core/modules/field/lib/Drupal/field/Plugin/Type/Formatter/FormatterInterface.php b/core/modules/field/lib/Drupal/field/Plugin/Type/Formatter/FormatterInterface.php index 70bc59a..f5fe980 100644 --- a/core/modules/field/lib/Drupal/field/Plugin/Type/Formatter/FormatterInterface.php +++ b/core/modules/field/lib/Drupal/field/Plugin/Type/Formatter/FormatterInterface.php @@ -36,9 +36,8 @@ public function settingsForm(array $form, array &$form_state); /** * Returns a short summary for the current formatter settings. * - * If an empty result is returned, the formatter is assumed to have no - * configurable settings, and no UI will be provided to display a settings - * form. + * If an empty result is returned, a UI can still be provided to display + * a settings form in case the formatter has configurable settings. * * @return array() * A short summary of the formatter settings. diff --git a/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetInterface.php b/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetInterface.php index e27484e..f927e14 100644 --- a/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetInterface.php +++ b/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetInterface.php @@ -42,9 +42,8 @@ public function settingsForm(array $form, array &$form_state); /** * Returns a short summary for the current widget settings. * - * If an empty result is returned, the widget is assumed to have no - * configurable settings, and no UI will be provided to display a settings - * form. + * If an empty result is returned, a UI can still be provided to display + * a settings form in case the widget has configurable settings. * * @return array * A short summary of the widget settings. diff --git a/core/modules/field/tests/modules/field_test/lib/Drupal/field_test/Plugin/field/formatter/TestFieldEmptySettingFormatter.php b/core/modules/field/tests/modules/field_test/lib/Drupal/field_test/Plugin/field/formatter/TestFieldEmptySettingFormatter.php new file mode 100644 index 0000000..4600851 --- /dev/null +++ b/core/modules/field/tests/modules/field_test/lib/Drupal/field_test/Plugin/field/formatter/TestFieldEmptySettingFormatter.php @@ -0,0 +1,67 @@ + t('Setting'), + '#type' => 'textfield', + '#size' => 20, + '#default_value' => $this->getSetting('field_empty_setting'), + '#required' => TRUE, + ); + return $element; + } + + /** + * {@inheritdoc} + */ + public function settingsSummary() { + $summary = array(); + $setting = $this->getSetting('field_empty_setting'); + if (!empty($setting)) { + $summary[] = t('Default empty setting now has a value.'); + } + return $summary; + } + + /** + * {@inheritdoc} + */ + public function viewElements(EntityInterface $entity, $langcode, FieldInterface $items) { + $elements = array(); + + if (!empty($items)) { + foreach ($items as $delta => $item) { + $elements[$delta] = array('#markup' => $this->getSetting('field_empty_setting')); + } + } + + return $elements; + } +} diff --git a/core/modules/field_ui/lib/Drupal/field_ui/DisplayOverviewBase.php b/core/modules/field_ui/lib/Drupal/field_ui/DisplayOverviewBase.php index 3f9adea..a157bc1 100644 --- a/core/modules/field_ui/lib/Drupal/field_ui/DisplayOverviewBase.php +++ b/core/modules/field_ui/lib/Drupal/field_ui/DisplayOverviewBase.php @@ -355,6 +355,8 @@ protected function buildFieldRow($field_id, FieldInstanceInterface $instance, En '#markup' => '