diff --git a/core/lib/Drupal/Core/Field/Annotation/FieldType.php b/core/lib/Drupal/Core/Field/Annotation/FieldType.php index 0b49326..8a46f2b 100644 --- a/core/lib/Drupal/Core/Field/Annotation/FieldType.php +++ b/core/lib/Drupal/Core/Field/Annotation/FieldType.php @@ -56,9 +56,9 @@ class FieldType extends DataType { /** * The category under which the condition should listed in the UI. * - * @var \Drupal\Core\Annotation\Translation - * * @ingroup plugin_translatable + * + * @var \Drupal\Core\Annotation\Translation */ public $category = ''; diff --git a/core/lib/Drupal/Core/Field/FieldTypePluginManager.php b/core/lib/Drupal/Core/Field/FieldTypePluginManager.php index c201abf..bb35ae6 100644 --- a/core/lib/Drupal/Core/Field/FieldTypePluginManager.php +++ b/core/lib/Drupal/Core/Field/FieldTypePluginManager.php @@ -95,6 +95,11 @@ public function processDefinition(&$definition, $plugin_id) { if (!isset($definition['list_class'])) { $definition['list_class'] = '\Drupal\Core\Field\FieldItemList'; } + + // Ensure that every field type has a category. + if (empty($definition['category'])) { + $definition['category'] = $this->t('General'); + } } /** diff --git a/core/modules/field_ui/src/Form/FieldStorageAddForm.php b/core/modules/field_ui/src/Form/FieldStorageAddForm.php index eee7934..1c95aa6 100644 --- a/core/modules/field_ui/src/Form/FieldStorageAddForm.php +++ b/core/modules/field_ui/src/Form/FieldStorageAddForm.php @@ -121,12 +121,7 @@ public function buildForm(array $form, FormStateInterface $form_state, $entity_t $field_type_options = array(); foreach ($this->fieldTypePluginManager->getGroupedDefinitions($this->fieldTypePluginManager->getUiDefinitions()) as $category => $field_types) { foreach ($field_types as $name => $field_type) { - if ($category) { - $field_type_options[$category][$name] = $field_type['label']; - } - else { - $field_type_options[$name] = $field_type['label']; - } + $field_type_options[$category][$name] = $field_type['label']; } }