Problem/Motivation
Getting the message "Creation of dynamic property SimplifyFormatter::$language_manager is deprecated" when accessing the content type that has the date field using simplify as formatter after upgraded to php8.2+. Please find the attached patch for review. Thanks very much for any help!
Steps to reproduce
upgrade to php 8.2+ for Drupal core 10.2.2 will throw the depreciation message when accessing the content type that has the date field using simplify as formatter.
Message Deprecated function: Creation of dynamic property Drupal\daterange_simplify\Plugin\Field\FieldFormatter\SimplifyFormatter::$language_manager is deprecated in Drupal\daterange_simplify\Plugin\Field\FieldFormatter\SimplifyFormatterBase->__construct() (line 51 of /app/web/modules/contrib/daterange_simplify/src/Plugin/Field/FieldFormatter/SimplifyFormatterBase.php)
#0 /app/web/core/includes/bootstrap.inc(164): _drupal_error_handler_real(8192, 'Creation of dyn...', '/app/web/module...', 51)
#1 /app/web/modules/contrib/daterange_simplify/src/Plugin/Field/FieldFormatter/SimplifyFormatterBase.php(51): _drupal_error_handler(8192, 'Creation of dyn...', '/app/web/module...', 51)
#2 /app/web/modules/contrib/daterange_simplify/src/Plugin/Field/FieldFormatter/SimplifyFormatterBase.php(59): Drupal\daterange_simplify\Plugin\Field\FieldFormatter\SimplifyFormatterBase->__construct('daterange_simpl...', Array, Object(Drupal\field\Entity\FieldConfig), Array, 'hidden', 'default', Array, Object(Drupal\language\ConfigurableLanguageManager), Object(Drupal\daterange_simplify\Simplify))
#3 /app/web/core/lib/Drupal/Core/Field/FormatterPluginManager.php(64): Drupal\daterange_simplify\Plugin\Field\FieldFormatter\SimplifyFormatterBase::create(Object(Drupal\Core\DependencyInjection\Container), Array, 'daterange_simpl...', Array)
#4 /app/web/core/lib/Drupal/Core/Field/FormatterPluginManager.php(126): Drupal\Core\Field\FormatterPluginManager->createInstance('daterange_simpl...', Array)
#5 /app/web/core/lib/Drupal/Core/Entity/Entity/EntityViewDisplay.php(205): Drupal\Core\Field\FormatterPluginManager->getInstance(Array)
#6 /app/web/core/lib/Drupal/Core/Entity/Entity/EntityViewDisplay.php(241): Drupal\Core\Entity\Entity\EntityViewDisplay->getRenderer('field_dates')
#7 /app/web/core/lib/Drupal/Core/Entity/EntityViewBuilder.php(339): Drupal\Core\Entity\Entity\EntityViewDisplay->buildMultiple(Array)
#8 /app/web/core/modules/node/src/NodeViewBuilder.php(24): Drupal\Core\Entity\EntityViewBuilder->buildComponents(Array, Array, Array, 'default')
#9 /app/web/core/lib/Drupal/Core/Entity/EntityViewBuilder.php(281): Drupal\node\NodeViewBuilder->buildComponents(Array, Array, Array, 'default')
#10 /app/web/core/lib/Drupal/Core/Entity/EntityViewBuilder.php(238): Drupal\Core\Entity\EntityViewBuilder->buildMultiple(Array)
#11 [internal function]: Drupal\Core\Entity\EntityViewBuilder->build(Array)
#12 /app/web/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php(111): call_user_func_array(Array, Array)
#13 /app/web/core/lib/Drupal/Core/Render/Renderer.php(858): Drupal\Core\Render\Renderer->doTrustedCallback(Array, Array, 'Render #pre_ren...', 'exception', 'Drupal\\Core\\Ren...')
#14 /app/web/core/lib/Drupal/Core/Render/Renderer.php(421): Drupal\Core\Render\Renderer->doCallback('#pre_render', Array, Array)
#15 /app/web/core/lib/Drupal/Core/Render/Renderer.php(240): Drupal\Core\Render\Renderer->doRender(Array, true)
#16 /app/web/core/lib/Drupal/Core/Render/Renderer.php(165): Drupal\Core\Render\Renderer->render(Array, true)
#17 /app/web/core/lib/Drupal/Core/Render/Renderer.php(627): Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}()
#18 /app/web/core/lib/Drupal/Core/Render/Renderer.php(164): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#19 /app/web/modules/contrib/search_api/src/Plugin/search_api/processor/RenderedItem.php(219): Drupal\Core\Render\Renderer->renderPlain(Array)
#20 /app/web/modules/contrib/search_api/src/Utility/FieldsHelper.php(319): Drupal\search_api\Plugin\search_api\processor\RenderedItem->addFieldValues(Object(Drupal\search_api\Item\Item))
#21 /app/web/modules/contrib/search_api/src/Plugin/search_api/processor/Highlight.php(387): Drupal\search_api\Utility\FieldsHelper->extractItemValues(Array, Array, true)
#22 /app/web/modules/contrib/search_api/src/Plugin/search_api/processor/Highlight.php(337): Drupal\search_api\Plugin\search_api\processor\Highlight->getFulltextFields(Array, NULL, true)
#23 /app/web/modules/contrib/search_api/src/Plugin/search_api/processor/Highlight.php(269): Drupal\search_api\Plugin\search_api\processor\Highlight->highlightFields(Array, Array)
#24 /app/web/modules/contrib/search_api/src/Entity/Index.php(675): Drupal\search_api\Plugin\search_api\processor\Highlight->postprocessSearchResults(Object(Drupal\search_api\Query\ResultSet))
#25 /app/web/modules/contrib/search_api/src/Query/Query.php(619): Drupal\search_api\Entity\Index->postprocessSearchResults(Object(Drupal\search_api\Query\ResultSet))
#26 /app/web/modules/contrib/search_api/src/Query/Query.php(551): Drupal\search_api\Query\Query->postExecute()
#27 /app/web/modules/contrib/search_api/src/Plugin/views/query/SearchApiQuery.php(621): Drupal\search_api\Query\Query->execute()
#28 /app/web/core/modules/views/src/ViewExecutable.php(1468): Drupal\search_api\Plugin\views\query\SearchApiQuery->execute(Object(Drupal\views\ViewExecutable))
#29 /app/web/core/modules/views/src/ViewExecutable.php(1496): Drupal\views\ViewExecutable->execute(NULL)
#30 /app/web/core/modules/views/src/Plugin/views/display/Page.php(199): Drupal\views\ViewExecutable->render()
#31 /app/web/core/modules/views/src/ViewExecutable.php(1672): Drupal\views\Plugin\views\display\Page->execute()
#32 /app/web/core/modules/views/src/Element/View.php(81): Drupal\views\ViewExecutable->executeDisplay('page_1', Array)
#33 [internal function]: Drupal\views\Element\View::preRenderViewElement(Array)
#34 /app/web/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php(111): call_user_func_array(Array, Array)
#35 /app/web/core/lib/Drupal/Core/Render/Renderer.php(858): Drupal\Core\Render\Renderer->doTrustedCallback(Array, Array, 'Render #pre_ren...', 'exception', 'Drupal\\Core\\Ren...')
#36 /app/web/core/lib/Drupal/Core/Render/Renderer.php(421): Drupal\Core\Render\Renderer->doCallback('#pre_render', Array, Array)
#37 /app/web/core/lib/Drupal/Core/Render/Renderer.php(240): Drupal\Core\Render\Renderer->doRender(Array, false)
#38 /app/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(238): Drupal\Core\Render\Renderer->render(Array, false)
#39 /app/web/core/lib/Drupal/Core/Render/Renderer.php(627): Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}()
#40 /app/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(231): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#41 /app/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(128): Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\CurrentRouteMatch))
#42 /app/web/core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php(90): Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\CurrentRouteMatch))
#43 [internal function]: Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object(Symfony\Component\HttpKernel\Event\ViewEvent), 'kernel.view', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
#44 /app/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func(Array, Object(Symfony\Component\HttpKernel\Event\ViewEvent), 'kernel.view', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
#45 /app/vendor/symfony/http-kernel/HttpKernel.php(186): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object(Symfony\Component\HttpKernel\Event\ViewEvent), 'kernel.view')
#46 /app/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#47 /app/web/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#48 /app/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#49 /app/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#50 /app/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#51 /app/web/core/modules/ban/src/BanMiddleware.php(50): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#52 /app/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\ban\BanMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#53 /app/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#54 /app/web/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#55 /app/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#56 /app/web/core/lib/Drupal/Core/DrupalKernel.php(704): Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#57 /app/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#58 {main}
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes