Views - Date issue

Created on 28 March 2024, 9 months ago
Updated 5 April 2024, 9 months ago

Problem/Motivation

When I tried to add custom field to views where is date field I am getting 2 following error in logs:

Error: Class "Drupal\Core\Datetime\TimeZoneFormHelper" not found in Drupal\custom_field\Plugin\CustomField\FieldFormatter\DateTimeFormatterBase->settingsForm() (line 69 of \modules\contrib\custom_field\src\Plugin\CustomField\FieldFormatter\DateTimeFormatterBase.php)


#0 \modules\contrib\custom_field\src\Plugin\CustomField\FieldFormatter\DateTimeDefaultFormatter.php(45): Drupal\custom_field\Plugin\CustomField\FieldFormatter\DateTimeFormatterBase->settingsForm(Array, Object(Drupal\Core\Form\FormState), Array)
#1 \modules\contrib\custom_field\src\Plugin\Field\FieldFormatter\BaseFormatter.php(137): Drupal\custom_field\Plugin\CustomField\FieldFormatter\DateTimeDefaultFormatter->settingsForm(Array, Object(Drupal\Core\Form\FormState), Array)
#2 \core\modules\views\src\Plugin\views\field\EntityField.php(500): Drupal\custom_field\Plugin\Field\FieldFormatter\BaseFormatter->settingsForm(Array, Object(Drupal\Core\Form\FormState))
#3 \core\modules\views_ui\src\Form\Ajax\ConfigHandler.php(166): Drupal\views\Plugin\views\field\EntityField->buildOptionsForm(Array, Object(Drupal\Core\Form\FormState))
#4 [internal function]: Drupal\views_ui\Form\Ajax\ConfigHandler->buildForm(Array, Object(Drupal\Core\Form\FormState))
#5 \core\lib\Drupal\Core\Form\FormBuilder.php(536): call_user_func_array(Array, Array)
#6 \core\lib\Drupal\Core\Form\FormBuilder.php(283): Drupal\Core\Form\FormBuilder->retrieveForm('views_ui_config...', Object(Drupal\Core\Form\FormState))
#7 \core\modules\views_ui\src\Form\Ajax\ViewsFormBase.php(215): Drupal\Core\Form\FormBuilder->buildForm('Drupal\\views_ui...', Object(Drupal\Core\Form\FormState))
#8 \core\lib\Drupal\Core\Render\Renderer.php(580): Drupal\views_ui\Form\Ajax\ViewsFormBase->Drupal\views_ui\Form\Ajax\{closure}()
#9 \core\modules\views_ui\src\Form\Ajax\ViewsFormBase.php(217): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#10 \core\modules\views_ui\src\Form\Ajax\ViewsFormBase.php(127): Drupal\views_ui\Form\Ajax\ViewsFormBase->ajaxFormWrapper('Drupal\\views_ui...', Object(Drupal\Core\Form\FormState))
#11 \core\modules\views_ui\src\Form\Ajax\ConfigHandler.php(39): Drupal\views_ui\Form\Ajax\ViewsFormBase->getForm(Object(Drupal\views_ui\ViewUI), 'default', 'ajax')
#12 [internal function]: Drupal\views_ui\Form\Ajax\ConfigHandler->getForm(Object(Drupal\views_ui\ViewUI), 'default', 'ajax', 'field', 'field_status')
#13 \core\lib\Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#14 \core\lib\Drupal\Core\Render\Renderer.php(580): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#15 \core\lib\Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#16 \core\lib\Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#17 C:\wamp64\www\d9-511\vendor\symfony\http-kernel\HttpKernel.php(169): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#18 C:\wamp64\www\d9-511\vendor\symfony\http-kernel\HttpKernel.php(81): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#19 \core\lib\Drupal\Core\StackMiddleware\Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#20 \core\lib\Drupal\Core\StackMiddleware\KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#21 \core\lib\Drupal\Core\StackMiddleware\ReverseProxyMiddleware.php(48): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#22 \core\lib\Drupal\Core\StackMiddleware\NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#23 C:\wamp64\www\d9-511\vendor\stack\builder\src\Stack\StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#24 \core\lib\Drupal\Core\DrupalKernel.php(718): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#25 \index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))

and also :

Warning: Undefined array key "key_label" in Drupal\custom_field\Plugin\CustomField\FieldFormatter\StringFormatter->formatValue() (line 81 of \modules\contrib\custom_field\src\Plugin\CustomField\FieldFormatter\StringFormatter.php)

#0 \core\includes\bootstrap.inc(347): _drupal_error_handler_real(2, 'Undefined array...', 'C:\\wamp64\\www\\d...', 81)
#1 \modules\contrib\custom_field\src\Plugin\CustomField\FieldFormatter\StringFormatter.php(81): _drupal_error_handler(2, 'Undefined array...', 'C:\\wamp64\\www\\d...', 81)
#2 \modules\contrib\custom_field\src\Plugin\Field\FieldFormatter\BaseFormatter.php(311): Drupal\custom_field\Plugin\CustomField\FieldFormatter\StringFormatter->formatValue(Object(Drupal\custom_field\Plugin\Field\FieldType\CustomItem), Object(Drupal\custom_field\Plugin\CustomField\FieldType\StringType), Array)
#3 \modules\contrib\custom_field\src\Plugin\Field\FieldFormatter\CustomListFormatter.php(91): Drupal\custom_field\Plugin\Field\FieldFormatter\BaseFormatter->getFormattedValues(Object(Drupal\custom_field\Plugin\Field\FieldType\CustomItem), 'en')
#4 \modules\contrib\custom_field\src\Plugin\Field\FieldFormatter\BaseFormatter.php(206): Drupal\custom_field\Plugin\Field\FieldFormatter\CustomListFormatter->viewValue(Object(Drupal\custom_field\Plugin\Field\FieldType\CustomItem))
#5 \core\lib\Drupal\Core\Field\FormatterBase.php(89): Drupal\custom_field\Plugin\Field\FieldFormatter\BaseFormatter->viewElements(Object(Drupal\custom_field\Plugin\Field\FieldType\CustomItemList), 'en')
#6 \core\lib\Drupal\Core\Entity\Entity\EntityViewDisplay.php(265): Drupal\Core\Field\FormatterBase->view(Object(Drupal\custom_field\Plugin\Field\FieldType\CustomItemList), 'en')
#7 \core\modules\views\src\Entity\Render\EntityFieldRenderer.php(256): Drupal\Core\Entity\Entity\EntityViewDisplay->buildMultiple(Array)
#8 \core\modules\views\src\Entity\Render\EntityFieldRenderer.php(143): Drupal\views\Entity\Render\EntityFieldRenderer->buildFields(Array)
#9 \core\modules\views\src\Plugin\views\field\EntityField.php(833): Drupal\views\Entity\Render\EntityFieldRenderer->render(Object(Drupal\views\ResultRow), Object(Drupal\views\Plugin\views\field\EntityField))
#10 \core\modules\views\src\Plugin\views\field\FieldPluginBase.php(1151): Drupal\views\Plugin\views\field\EntityField->getItems(Object(Drupal\views\ResultRow))
#11 \core\modules\views\views.theme.inc(238): Drupal\views\Plugin\views\field\FieldPluginBase->advancedRender(Object(Drupal\views\ResultRow))
#12 [internal function]: template_preprocess_views_view_field(Array, 'views_view_fiel...', Array)
#13 \core\lib\Drupal\Core\Theme\ThemeManager.php(287): call_user_func_array('template_prepro...', Array)
#14 \core\lib\Drupal\Core\Render\Renderer.php(433): Drupal\Core\Theme\ThemeManager->render('views_view_fiel...', Array)
#15 \core\lib\Drupal\Core\Render\Renderer.php(204): Drupal\Core\Render\Renderer->doRender(Array, false)
#16 \core\modules\views\src\Plugin\views\field\FieldPluginBase.php(1746): Drupal\Core\Render\Renderer->render(Array)
#17 \core\modules\views\src\Plugin\views\style\StylePluginBase.php(777): Drupal\views\Plugin\views\field\FieldPluginBase->theme(Object(Drupal\views\ResultRow))
#18 [internal function]: Drupal\views\Plugin\views\style\StylePluginBase->elementPreRenderRow(Array)
#19 \core\lib\Drupal\Core\Security\DoTrustedCallbackTrait.php(101): call_user_func_array(Array, Array)
#20 \core\lib\Drupal\Core\Render\Renderer.php(788): Drupal\Core\Render\Renderer->doTrustedCallback(Array, Array, 'Render #pre_ren...', 'exception', 'Drupal\\Core\\Ren...')
#21 \core\lib\Drupal\Core\Render\Renderer.php(374): Drupal\Core\Render\Renderer->doCallback('#pre_render', Array, Array)
#22 \core\lib\Drupal\Core\Render\Renderer.php(204): Drupal\Core\Render\Renderer->doRender(Array, true)
#23 \core\lib\Drupal\Core\Render\Renderer.php(160): Drupal\Core\Render\Renderer->render(Array, true)
#24 \core\lib\Drupal\Core\Render\Renderer.php(580): Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}()
#25 \core\lib\Drupal\Core\Render\Renderer.php(161): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#26 \core\modules\views\src\Plugin\views\style\StylePluginBase.php(719): Drupal\Core\Render\Renderer->renderPlain(Array)
#27 \core\modules\views\src\Plugin\views\style\StylePluginBase.php(582): Drupal\views\Plugin\views\style\StylePluginBase->renderFields(Array)
#28 \core\modules\views\src\Plugin\views\style\StylePluginBase.php(473): Drupal\views\Plugin\views\style\StylePluginBase->renderGrouping(Array, Array, true)
#29 \core\modules\views\src\Plugin\views\display\DisplayPluginBase.php(2169): Drupal\views\Plugin\views\style\StylePluginBase->render(Array)
#30 \core\modules\views\src\ViewExecutable.php(1538): Drupal\views\Plugin\views\display\DisplayPluginBase->render()
#31 \core\modules\views\src\Plugin\views\display\DisplayPluginBase.php(2459): Drupal\views\ViewExecutable->render()
#32 \core\modules\views\src\ViewExecutable.php(1667): Drupal\views\Plugin\views\display\DisplayPluginBase->preview()
#33 \core\modules\views_ui\src\ViewUI.php(611): Drupal\views\ViewExecutable->preview('default', Array)
#34 \core\modules\views_ui\src\ViewPreviewForm.php(62): Drupal\views_ui\ViewUI->renderPreview('default', Array)
#35 \core\lib\Drupal\Core\Entity\EntityForm.php(106): Drupal\views_ui\ViewPreviewForm->form(Array, Object(Drupal\Core\Form\FormState))
#36 \core\modules\views_ui\src\ViewFormBase.php(41): Drupal\Core\Entity\EntityForm->buildForm(Array, Object(Drupal\Core\Form\FormState))
#37 [internal function]: Drupal\views_ui\ViewFormBase->buildForm(Array, Object(Drupal\Core\Form\FormState), 'default')
#38 \core\lib\Drupal\Core\Form\FormBuilder.php(536): call_user_func_array(Array, Array)
#39 \core\lib\Drupal\Core\Form\FormBuilder.php(375): Drupal\Core\Form\FormBuilder->retrieveForm('view_preview_fo...', Object(Drupal\Core\Form\FormState))
#40 \core\lib\Drupal\Core\Form\FormBuilder.php(633): Drupal\Core\Form\FormBuilder->rebuildForm('view_preview_fo...', Object(Drupal\Core\Form\FormState), Array)
#41 \core\lib\Drupal\Core\Form\FormBuilder.php(325): Drupal\Core\Form\FormBuilder->processForm('view_preview_fo...', Array, Object(Drupal\Core\Form\FormState))
#42 \core\lib\Drupal\Core\Controller\FormController.php(73): Drupal\Core\Form\FormBuilder->buildForm(Object(Drupal\views_ui\ViewPreviewForm), Object(Drupal\Core\Form\FormState))
#43 [internal function]: Drupal\Core\Controller\FormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch))
#44 \core\lib\Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#45 \core\lib\Drupal\Core\Render\Renderer.php(580): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#46 \core\lib\Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#47 \core\lib\Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#48 C:\wamp64\www\d9-511\vendor\symfony\http-kernel\HttpKernel.php(169): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#49 C:\wamp64\www\d9-511\vendor\symfony\http-kernel\HttpKernel.php(81): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#50 \core\lib\Drupal\Core\StackMiddleware\Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#51 \core\lib\Drupal\Core\StackMiddleware\KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#52 \core\lib\Drupal\Core\StackMiddleware\ReverseProxyMiddleware.php(48): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#53 \core\lib\Drupal\Core\StackMiddleware\NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#54 C:\wamp64\www\d9-511\vendor\stack\builder\src\Stack\StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#55 \core\lib\Drupal\Core\DrupalKernel.php(718): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#56 \index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
πŸ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡ΈπŸ‡°Slovakia coaston

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @coaston
  • Status changed to Needs review 9 months ago
  • πŸ‡ΈπŸ‡°Slovakia coaston

    I can confirm - there is no issue with 3.x-dev, Is is possible to back-port this fix to 2.x-dev version also please?

  • πŸ‡ΊπŸ‡ΈUnited States apmsooner

    Okay, I just discovered the TimeZoneFormHelper class was introduced to Drupal core 10.1 so assuming you may have a core version that is before then. I will I guess have to roll that change back in 2.x version.

  • Status changed to Fixed 9 months ago
  • πŸ‡ΊπŸ‡ΈUnited States apmsooner

    Fixed in dev. Release on the way.

  • Status changed to Fixed 9 months ago
  • πŸ‡ΊπŸ‡ΈUnited States apmsooner
Production build 0.71.5 2024