Unable to set as default theme

Created on 25 August 2023, about 1 year ago
Updated 2 September 2023, about 1 year ago

Problem/Motivation

Php 8.1.13 and Drupal 10.1

1. Download via Composer
2. Install
3. Set as default theme
4. Visit any content page

following error :

The website encountered an unexpected error. Please try again later.

Error: Call to a member function isEmpty() on null in zadmin_preprocess_page() (line 51 of themes\contrib\zadmin\zadmin.theme).
call_user_func_array('zadmin_preprocess_page', Array) (Line: 285)
Drupal\Core\Theme\ThemeManager->render('page', Array) (Line: 436)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 204)
Drupal\Core\Render\Renderer->render(Array) (Line: 474)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 90)
__TwigTemplate_f3ff4d39c7414eb102db100b622027cb->doDisplay(Array, Array) (Line: 394)
Twig\Template->displayWithErrorHandling(Array, Array) (Line: 367)
Twig\Template->display(Array) (Line: 379)
Twig\Template->render(Array, Array) (Line: 40)
Twig\TemplateWrapper->render(Array) (Line: 53)
twig_render_template('themes/contrib/zadmin/templates/layout/html.html.twig', Array) (Line: 372)
Drupal\Core\Theme\ThemeManager->render('html', Array) (Line: 436)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 204)
Drupal\Core\Render\Renderer->render(Array) (Line: 158)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 583)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 159)
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: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.view') (Line: 171)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 74)
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: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Ob
🐛 Bug report
Status

RTBC

Version

1.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
  • Assigned to shalini_jha
  • 🇮🇳India shalini_jha

    I am checking this issue.

  • First commit to issue fork.
  • @shubham_jain opened merge request.
  • Issue was unassigned.
  • Status changed to Needs review about 1 year ago
  • 🇮🇳India shalini_jha

    Hi @coaston
    I have added this patch for the fixes of your mentioned issue. Kindly Please Check.

  • 🇮🇳India shubham_jain

    Hi, I have resolved this issue and pushed the code to the issue branch.

    The issue was in the isEmpty() as well as in theme_path functions in the file. Both the functions were no longer in use and the they have to be replaced.
    I have remove those functions and added the updated version of those functions. I have also resolved the compatibility issue for Drupal 9.

    Please review and verify the pushed code.

  • 🇸🇰Slovakia coaston

    Hello,

    Now I am experiencing different issue :

    The website encountered an unexpected error. Please try again later.
    
    Error: Call to undefined function drupal_get_path() in zadmin_preprocess_page() (line 56 of themes\contrib\zadmin\zadmin.theme).
    call_user_func_array('zadmin_preprocess_page', Array) (Line: 285)
    Drupal\Core\Theme\ThemeManager->render('page', Array) (Line: 436)
    Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 204)
    Drupal\Core\Render\Renderer->render(Array) (Line: 474)
    Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 90)
    __TwigTemplate_f3ff4d39c7414eb102db100b622027cb->doDisplay(Array, Array) (Line: 394)
    Twig\Template->displayWithErrorHandling(Array, Array) (Line: 367)
    Twig\Template->display(Array) (Line: 379)
    Twig\Template->render(Array, Array) (Line: 40)
    Twig\TemplateWrapper->render(Array) (Line: 53)
    twig_render_template('themes/contrib/zadmin/templates/layout/html.html.twig', Array) (Line: 372)
    Drupal\Core\Theme\ThemeManager->render('html', Array) (Line: 436)
    Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 204)
    Drupal\Core\Render\Renderer->render(Array) (Line: 158)
    Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 583)
    Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 159)
    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: 111)
    Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.view') (Line: 171)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 2) (Line: 74)
    Symfony\Component\HttpKernel\HttpKernel->handle(Object, 2, 1) (Line: 58)
    Drupal\Core\StackMiddleware\Session->handle(Object, 2, 1) (Line: 48)
    Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 2, 1) (Line: 106)
    Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 2, 1) (Line: 85)
    Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 2, 1) (Line: 48)
    Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 2, 1) (Line: 51)
    Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 2, 1) (Line: 51)
    Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 2) (Line: 166)
    Drupal\Core\EventSubscriber\DefaultExceptionHtmlSubscriber->makeSubrequest(Object, '/system/404', 404) (Line: 122)
    Drupal\Core\EventSubscriber\DefaultExceptionHtmlSubscriber->on404(Object) (Line: 109)
    Drupal\Core\EventSubscriber\HttpExceptionSubscriberBase->onException(Object, 'kernel.exception', Object)
    call_user_func(Array, Object, 'kernel.exception', Object) (Line: 111)
    Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.exception') (Line: 224)
    Symfony\Component\HttpKernel\HttpKernel->handleThrowable(Object, Object, 1) (Line: 89)
    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: 51)
    Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
    Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
  • Status changed to RTBC about 1 year ago
  • 🇮🇳India Shreya_98

    Move to RTBC.

Production build 0.71.5 2024