Problem/Motivation
Hi there,
running latest version of Drupal 9 and I'm unable to add any font displays for Google Fonts. Any suggestions?
Web Server: Apache
Drupal Version: 9.0.3
PHP Version: 7.4.5
Database Version: 5.7.28-nmm1-log
The website encountered an unexpected error. Please try again later.
Location: admin/appearance/font/font_display/add
Referrer: /admin/appearance/font/font_display/add
Message: Drupal\Core\Config\Schema\SchemaIncompleteException: Entity type 'Drupal\Core\Config\Entity\ConfigEntityType' is missing 'config_export' definition in its annotation in Drupal\Core\Config\Entity\ConfigEntityBase->toArray() (line 251 of ***/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php).
Steps to reproduce
Add Font display
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | 3166900_add_font_causes_error_d9.patch | 1.81 KB | jfeltkamp |
| #8 | 3166900-8.patch | 863 bytes | neslee canil pinto |
Comments
Comment #2
hilrap commentedNot possible to add loacal font either:
Error: Call to undefined function file_prepare_directory() in local_fonts_save_and_generate_css() (line 105 of /***/modules/fontyourface/modules/local_fonts/local_fonts.module)
#0 /***/modules/fontyourface/modules/local_fonts/local_fonts.module(53): local_fonts_save_and_generate_css(Object(Drupal\local_fonts\Entity\LocalFontConfigEntity))
#1 [internal function]: local_fonts_entity_presave(Object(Drupal\local_fonts\Entity\LocalFontConfigEntity), 'local_font_conf...')
#2 /***/core/lib/Drupal/Core/Extension/ModuleHandler.php(403): call_user_func_array('local_fonts_ent...', Array)
#3 /***/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php(349): Drupal\Core\Extension\ModuleHandler->invokeAll('entity_presave', Array)
#4 /***/core/lib/Drupal/Core/Entity/EntityStorageBase.php(495): Drupal\Core\Config\Entity\ConfigEntityStorage->invokeHook('presave', Object(Drupal\local_fonts\Entity\LocalFontConfigEntity))
#5 /***/core/lib/Drupal/Core/Entity/EntityStorageBase.php(449): Drupal\Core\Entity\EntityStorageBase->doPreSave(Object(Drupal\local_fonts\Entity\LocalFontConfigEntity))
#6 /***/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php(263): Drupal\Core\Entity\EntityStorageBase->save(Object(Drupal\local_fonts\Entity\LocalFontConfigEntity))
#7 /***/core/lib/Drupal/Core/Entity/EntityBase.php(339): Drupal\Core\Config\Entity\ConfigEntityStorage->save(Object(Drupal\local_fonts\Entity\LocalFontConfigEntity))
#8 /***/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php(591): Drupal\Core\Entity\EntityBase->save()
#9 /***/modules/fontyourface/modules/local_fonts/src/Form/LocalFontConfigEntityForm.php(136): Drupal\Core\Config\Entity\ConfigEntityBase->save()
#10 [internal function]: Drupal\local_fonts\Form\LocalFontConfigEntityForm->save(Array, Object(Drupal\Core\Form\FormState))
#11 /***/core/lib/Drupal/Core/Form/FormSubmitter.php(113): call_user_func_array(Array, Array)
#12 /***/core/lib/Drupal/Core/Form/FormSubmitter.php(51): Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object(Drupal\Core\Form\FormState))
#13 /***/core/lib/Drupal/Core/Form/FormBuilder.php(593): Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object(Drupal\Core\Form\FormState))
#14 /***/core/lib/Drupal/Core/Form/FormBuilder.php(321): Drupal\Core\Form\FormBuilder->processForm('local_font_conf...', Array, Object(Drupal\Core\Form\FormState))
#15 /***/core/lib/Drupal/Core/Controller/FormController.php(73): Drupal\Core\Form\FormBuilder->buildForm(Object(Drupal\local_fonts\Form\LocalFontConfigEntityForm), Object(Drupal\Core\Form\FormState))
#16 /***/core/modules/layout_builder/src/Controller/LayoutBuilderHtmlEntityFormController.php(39): Drupal\Core\Controller\FormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch))
#17 [internal function]: Drupal\layout_builder\Controller\LayoutBuilderHtmlEntityFormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch))
#18 /***/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#19 /***/core/lib/Drupal/Core/Render/Renderer.php(573): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#20 /***/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#21 /***/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#22 /***/vendor/symfony/http-kernel/HttpKernel.php(158): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#23 /***/vendor/symfony/http-kernel/HttpKernel.php(80): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#24 /***/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#25 /***/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#26 /***/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#27 /***/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#28 /***/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#29 /***/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#30 /***/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#31 /***/core/lib/Drupal/Core/DrupalKernel.php(705): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#32 /***/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#33 {main}
Comment #3
hilrap commentedComment #4
neslee canil pinto@hilrap did you run drupal update after updating your site to drupal 9?
Comment #5
hilrap commented@Neslee Canil Pinto yea i did. It's actuall a new Drupal 9 install, no upgrade from Durpal 8.
Comment #6
back from 7 commentedI get the same issue when trying to add a font display.
Once I save the font display, white screen error "The website encountered an unexpected error. Please try again later."
Comment #7
biabremer commentedI also have the same problem trying to add a custom font, with the same message "The website encountered an unexpected error. Please try again later.".
Comment #8
neslee canil pintoPatch that fixes the issue. Can you apply and confirm
Comment #9
GDH commentedThat patch didn't work for me. I was getting an error regarding calling a non-static function.
I tried:
\Drupal::service('file_system')->prepareDirectory($directory, FileSystemInterface::CREATE_DIRECTORY | FileSystemInterface::MODIFY_PERMISSIONS);But then I get a new error.
Uncaught PHP Exception Drupal\\Core\\Config\\Schema\\SchemaIncompleteException: "Entity type 'Drupal\\Core\\Config\\Entity\\ConfigEntityType' is missing 'config_export' definition in its annotation" at /var/www/MYSITE/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php line 251, referer: http://127.0.0.1/MYSITE/web/admin/appearance/font/local_font_config_enti...
Although it takes me to the same white page with the error message, it listed the local_font I uploaded in the browse section of http://127.0.0.1/MYSITE/web/admin/appearance/font
Comment #11
neslee canil pinto@GDH did you tried clearing cache. I am not getting that error in my drupal 9 site. And made a new release, which fixes this issue, can you please update the module to latest release.
Comment #12
sameer commentedI'm getting the same error as GDH. I'm using version 8.x-3.4 and Drupal 9.0.5.
I enable @fontyourface and @fontyourface - Local Fonts
Add custom font.
Get error:
Drupal\Core\Config\Schema\SchemaIncompleteException: Entity type 'Drupal\Core\Config\Entity\ConfigEntityType' is missing 'config_export' definition in its annotation in Drupal\Core\Config\Entity\ConfigEntityBase->toArray() (line 251 of core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php).Go to Browse. Font appears here. I enable it.
Add font display.
Get same error:
Drupal\Core\Config\Schema\SchemaIncompleteException: Entity type 'Drupal\Core\Config\Entity\ConfigEntityType' is missing 'config_export' definition in its annotation in Drupal\Core\Config\Entity\ConfigEntityBase->toArray() (line 251 of core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php).Comment #13
jfeltkampThe module looks soooooooo good to me. This is exactly what I need.
But yes, same error, but in a totally differnt place.
Entity type 'Drupal\Core\Config\Entity\ConfigEntityType' is missing 'config_export' definition in its annotation.
There are some annotations to fix in the entity type. (Drupal\fontyourface\Entity\FontDisplay The annotation config on top of the class managing the Font-Display config entity. )
The last part with config_export is missing in the original code
I will have a look at this and try to fix in the next few days.
Comment #14
jfeltkampI created a patch where I fixed the issues with the missing 'config_export' thing (see above).
Now it is working for me in Drupal 9.
Comment #15
neslee canil pinto@JFeltkamp great work. Thanks. I did a test in my local and its working now without any errors.
Comment #17
neslee canil pintoCommitted to dev branch. Thanks.
Comment #18
neslee canil pinto