Subtheme Error - InvalidArgumentException: $string ("") must be a string. in Drupal\Core\StringTranslation\TranslatableMarkup-

Created on 27 February 2024, 10 months ago
Updated 18 March 2024, 9 months ago

Problem/Motivation

Hi all,

I was looking to create a subtheme of Belgrade Theme, in order to make minor changes like a font, color, ecc...
As documentation I created the subtheme, but when I apply it, pages give me errors display:

"InvalidArgumentException: $string ("") must be a string. in Drupal\Core\StringTranslation\TranslatableMarkup->__construct() (line 132 of core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php)."

If I change the base theme from " 'base theme': belgrade" " to " 'base theme': olivero " and clear the cache, pages are displayed correctly.

Any tips of what is wrong?

Thank you in advance,
Camila F.

Steps to reproduce

Drupal: 10.2.3
PHP Version: 8.2.5
Server: Apache/2.4.56 (Debian)
Database: MySQL 5.7.35

Folder structure:
theme > custom > gssolar >gssolar.info.yml

name: GSSolar Belgrade
type: theme
description: 'gssolar subtheme based on Belgrade theme.'
core_version_requirement: ^9.2 || ^10
'base theme': belgrade
libraries:
  - gssolar/global-styling
regions:
  navigation: 'Navigation'
  top_bar: 'Top bar'
  header: 'Header'
  highlighted: 'Highlighted'
  help: 'Help'
  content: 'Content'
  sidebar_first: 'Primary'
  sidebar_second: 'Secondary'
  footer: 'Footer'
  page_top: 'Page top'
  page_bottom: 'Page bottom'
  hidden: 'HIDDEN'

theme > custom > gssolar >gssolar.libraries.yml

global-styling:
  css:
    component:
      css/style.css: {}

theme > custom > gssolar > css > style.css
--> Empty by now

Error LOG

InvalidArgumentException: $string ("") must be a string. in Drupal\Core\StringTranslation\TranslatableMarkup->__construct() (line 132 of /app/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php).

#0 /app/core/includes/bootstrap.inc(102): Drupal\Core\StringTranslation\TranslatableMarkup->__construct(NULL, Array, Array)
#1 /app/themes/contrib/belgrade/includes/region.inc(25): t(NULL)
#2 [internal function]: belgrade_preprocess_region(Array, 'region', Array)
#3 /app/core/lib/Drupal/Core/Theme/ThemeManager.php(261): call_user_func_array('belgrade_prepro...', Array)
#4 /app/core/lib/Drupal/Core/Render/Renderer.php(536): Drupal\Core\Theme\ThemeManager->render('region', Array)
#5 /app/core/lib/Drupal/Core/Render/Renderer.php(240): Drupal\Core\Render\Renderer->doRender(Array, false)
#6 /app/core/lib/Drupal/Core/Template/TwigExtension.php(475): Drupal\Core\Render\Renderer->render(Array)
#7 /app/sites/default/files/php/twig/65de58750488b_page.html.twig_9yS19eBOUPc3NW8owLQFtWj6k/wlBllU0UpSZ3FLhcOvJA2sKsSmtZv5QwzL9uBXsUylE.php(45): Drupal\Core\Template\TwigExtension->escapeFilter(Object(Drupal\Core\Template\TwigEnvironment), Array, 'html', NULL, true)
#8 /app/vendor/twig/twig/src/Template.php(394): __TwigTemplate_029720e0bab9c7a2465184417162a4bb->doDisplay(Array, Array)
#9 /app/vendor/twig/twig/src/Template.php(367): Twig\Template->displayWithErrorHandling(Array, Array)
#10 /app/vendor/twig/twig/src/Template.php(379): Twig\Template->display(Array)
#11 /app/vendor/twig/twig/src/TemplateWrapper.php(38): Twig\Template->render(Array)
#12 /app/core/themes/engines/twig/twig.engine(39): Twig\TemplateWrapper->render(Array)
#13 /app/core/lib/Drupal/Core/Theme/ThemeManager.php(348): twig_render_template('themes/contrib/...', Array)
#14 /app/core/lib/Drupal/Core/Render/Renderer.php(480): Drupal\Core\Theme\ThemeManager->render('page', Array)
#15 /app/core/lib/Drupal/Core/Render/Renderer.php(240): Drupal\Core\Render\Renderer->doRender(Array, false)
#16 /app/core/lib/Drupal/Core/Template/TwigExtension.php(475): Drupal\Core\Render\Renderer->render(Array)
#17 /app/sites/default/files/php/twig/65de58750488b_html.html.twig_TLwMY6bfwf0qt5VH3UJdjtuCC/V4QSxS01vscEIzJJK-oBokTB21-dlyQi7_4KCbCwQ0I.php(80): Drupal\Core\Template\TwigExtension->escapeFilter(Object(Drupal\Core\Template\TwigEnvironment), Array, 'html', NULL, true)
#18 /app/vendor/twig/twig/src/Template.php(394): __TwigTemplate_a4e031f07c5d5dfec4c5ec5df445ca5c->doDisplay(Array, Array)
#19 /app/vendor/twig/twig/src/Template.php(367): Twig\Template->displayWithErrorHandling(Array, Array)
#20 /app/vendor/twig/twig/src/Template.php(379): Twig\Template->display(Array)
#21 /app/vendor/twig/twig/src/TemplateWrapper.php(38): Twig\Template->render(Array)
#22 /app/core/themes/engines/twig/twig.engine(39): Twig\TemplateWrapper->render(Array)
#23 /app/core/lib/Drupal/Core/Theme/ThemeManager.php(348): twig_render_template('core/modules/sy...', Array)
#24 /app/core/lib/Drupal/Core/Render/Renderer.php(480): Drupal\Core\Theme\ThemeManager->render('html', Array)
#25 /app/core/lib/Drupal/Core/Render/Renderer.php(240): Drupal\Core\Render\Renderer->doRender(Array, false)
#26 /app/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(158): Drupal\Core\Render\Renderer->render(Array)
#27 /app/core/lib/Drupal/Core/Render/Renderer.php(627): Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}()
#28 /app/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(153): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#29 /app/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))
#30 [internal function]: Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object(Symfony\Component\HttpKernel\Event\ViewEvent), 'kernel.view', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
#31 /app/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))
#32 /app/vendor/symfony/http-kernel/HttpKernel.php(186): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object(Symfony\Component\HttpKernel\Event\ViewEvent), 'kernel.view')
#33 /app/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#34 /app/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#35 /app/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#36 /app/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#37 /app/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#38 /app/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#39 /app/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#40 /app/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#41 /app/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#42 /app/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#43 /app/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#44 /app/core/lib/Drupal/Core/DrupalKernel.php(704): Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#45 /app/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#46 {main}
💬 Support request
Status

Fixed

Version

2.0

Component

Code

Created by

🇮🇹Italy alicacwb

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024