Problem
I am developing a website, just upgraded to core 9.3.12. Upgrade went well (composer), but after the upgrade I suddenly had an issue with Layout Builder.
In all Layout Builder enabled content types that existed before the upgrade I could now no longer edit the template for all 'foo' content type items. I can still edit the individual existing pages across different content types, just not the overall default template for each type.
When selecting "Edit the template for all Basic page content items instead" at top of a page layout, or when going through "structure> Content Types > Foo > Manage Display >> Manage Layout (Default or Full or other any existing one), I get a WSOD saying "The website encountered an unexpected error. Please try again later."
So I checked the error log, which tells me: "Uncaught PHP Exception InvalidArgumentException: "The timestamp must be numeric." at /.../core/lib/Drupal/Component/Datetime/DateTimePlus.php line 201". When I create a new content type and enable Layout Builder, all works fine, I can then edit individual pages as well as the content type template.
Switched on the level error messages, got the following stack, indicating Media entity slideshow was at the root of the error:
The website encountered an unexpected error. Please try again later.
InvalidArgumentException: The timestamp must be numeric. in Drupal\Component\Datetime\DateTimePlus::createFromTimestamp() (line 201 of core/lib/Drupal/Component/Datetime/DateTimePlus.php).
Drupal\Core\Datetime\DateFormatter->format(NULL, 'custom', 'Y-m-d\TH:i:s') (Line: 50)
Drupal\media_entity_slideshow\Plugin\media\Source\Slideshow->getMetadata(Object, 'default_name') (Line: 99)
Drupal\media\Entity\Media->getName() (Line: 109)
Drupal\media\Entity\Media->label() (Line: 355)
Drupal\Core\Entity\Plugin\EntityReferenceSelection\DefaultSelection->getReferenceableEntities(NULL, 'CONTAINS', 50) (Line: 305)
Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem::generateSampleValue(Object) (Line: 253)
Drupal\Core\Field\FieldItemList->generateSampleItems() (Line: 248)
Drupal\Core\Entity\ContentEntityStorageBase->createWithSampleValues('page') (Line: 55)
Drupal\layout_builder\Entity\LayoutBuilderSampleEntityGenerator->get('node', 'page') (Line: 224)
Drupal\layout_builder\Plugin\SectionStorage\DefaultsSectionStorage->getContextsDuringPreview() (Line: 71)
Drupal\layout_builder\Element\LayoutBuilder->getPopulatedContexts(Object) (Line: 236)
Drupal\layout_builder\Element\LayoutBuilder->buildAdministrativeSection(Object, 0) (Line: 124)
Drupal\layout_builder\Element\LayoutBuilder->layout(Object) (Line: 98)
Drupal\layout_builder\Element\LayoutBuilder->preRender(Array)
call_user_func_array(Array, Array) (Line: 101)
Drupal\Core\Render\Renderer->doTrustedCallback(Array, Array, 'Render #pre_render callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface or be an anonymous function. The callback was %s. See
https://www.drupal.org/node/2966725 →
', 'exception', 'Drupal\Core\Render\Element\RenderCallbackInterface') (Line: 772)
Drupal\Core\Render\Renderer->doCallback('#pre_render', Array, Array) (Line: 363)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 435)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 201)
Drupal\Core\Render\Renderer->render(Array, ) (Line: 241)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 564)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 242)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 132)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
call_user_func(Array, Object, 'kernel.view', Object) (Line: 142)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.view') (Line: 163)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 80)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 708)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Uninstalled the module and hey presto, all Layout Builder Functionality was back in perfect working order.
In summary: before upgrading core to 9.3.12 all worked fine, after the upgrade Layout Builder on existing content types failed due to a timestamp issue triggered by Media Entity Slideshow