Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 300130

Triggering an error when a FieldType defines a default formatter that it can't use

$
0
0

Problem/Motivation

Follow-up #3112256: Let StringFormatter support UUID field type explicitly, as title.

Proposed resolution

Needs discussion

+++ b/core/lib/Drupal/Core/Field/FormatterPluginManager.php
@@ -183,7 +183,11 @@ public function getOptions($field_type = NULL) {
     if ($field_type) {
-      return !empty($this->formatterOptions[$field_type]) ? $this->formatterOptions[$field_type] : [];
+      if (!empty($this->formatterOptions[$field_type])) {
+        return $this->formatterOptions[$field_type];
+      }
+      @trigger_error("No default field formatter available to field type: $field_type or claimed default formatter does not support it. See https://www.drupal.org/project/drupal/issues/3112256.");
+      return [];
     }

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet


Viewing all articles
Browse latest Browse all 300130

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>