diff --git a/core/modules/field/tests/src/Kernel/FieldDefinitionAvailabilityTest.php b/core/modules/field/tests/src/Kernel/FieldDefinitionAvailabilityTest.php new file mode 100644 index 0000000..f7a75f3 --- /dev/null +++ b/core/modules/field/tests/src/Kernel/FieldDefinitionAvailabilityTest.php @@ -0,0 +1,105 @@ +origin === 'core' + && empty($module->info['hidden']) + && $module->status == FALSE + && $module->info['package'] !== 'Testing' + && ( + is_readable($module->getPath() . '/src/Entity') + || is_readable($module->getPath() . '/src/Plugin/Field') + )) { + return TRUE; + } + return FALSE; + }); + + if (!empty($modules['rest'])) { + unset($modules['rest']); + } + $this->enableModules(array_keys($modules)); + + /** @var \Drupal\Component\Plugin\Discovery\DiscoveryInterface $field_type_manager */ + /*$field_type_manager = \Drupal::service('plugin.manager.field.field_type');*/ + + /** @var \Drupal\Component\Plugin\Discovery\DiscoveryInterface $field_type_manager */ + $field_formatter_manager = \Drupal::service('plugin.manager.field.formatter'); + + /** @var \Drupal\Component\Plugin\Discovery\DiscoveryInterface $field_type_manager */ + $field_widget_manager = \Drupal::service('plugin.manager.field.widget'); + + /** @var \Drupal\Core\Entity\EntityFieldManagerInterface $entity_field_manager */ + $entity_field_manager = \Drupal::service('entity_field.manager'); + + /** @var \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager */ + $entity_type_manager = \Drupal::service('entity_type.manager'); + + + /** @var \Drupal\Core\Field\BaseFieldDefinition[][] $field_definitions */ + $field_definitions = []; + /** @var \Drupal\Core\Entity\EntityTypeInterface[] $content_entity_types */ + $content_entity_types = array_filter($entity_type_manager->getDefinitions(), function (EntityTypeInterface $entity_type) { + return $entity_type instanceof ContentEntityTypeInterface; + }); + + foreach ($content_entity_types as $entity_type_id => $entity_type_definition) { + $field_definitions[$entity_type_id] = $entity_field_manager->getBaseFieldDefinitions($entity_type_id); + } + + $plugin_not_found = []; + foreach ($field_definitions as $entity_type_id => $definitions) { + foreach ($definitions as $field_id => $field_definition) { + $view_display_options = $field_definition->getDisplayOptions('view'); + if (!empty($view_display_options) && !empty($view_display_options['type'])) { + try { + $field_formatter_manager->getDefinition($view_display_options['type']); + } + catch (PluginNotFoundException $e) { + $plugin_not_found[] = "PluginNotFoundException here for '{$entity_type_id}' entity type in '{$field_id}' field view display options. Original message: {$e->getMessage()}"; + } + } + $form_display_options = $field_definition->getDisplayOptions('form'); + if (!empty($form_display_options) && !empty($form_display_options['type'])) { + try { + $field_widget_manager->getDefinition($form_display_options['type']); + } + catch (PluginNotFoundException $e) { + $plugin_not_found[] = "PluginNotFoundException here for '{$entity_type_id}' entity type in '{$field_id}' field form display options. Original message: {$e->getMessage()}"; + } + } + } + } + + $this->assertEmpty($plugin_not_found, implode(" ", $plugin_not_found)); + } + +} diff --git a/core/modules/menu_link_content/src/Entity/MenuLinkContent.php b/core/modules/menu_link_content/src/Entity/MenuLinkContent.php index d53ba49..460c0df 100644 --- a/core/modules/menu_link_content/src/Entity/MenuLinkContent.php +++ b/core/modules/menu_link_content/src/Entity/MenuLinkContent.php @@ -316,7 +316,7 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) { ->setDefaultValue(0) ->setDisplayOptions('view', [ 'label' => 'hidden', - 'type' => 'integer', + 'type' => 'number_integer', 'weight' => 0, ]) ->setDisplayOptions('form', [