Problem/Motivation

Warning: Array to string conversion in Drupal\Core\Render\Markup::create() (line 36 of core/lib/Drupal/Component/Render/MarkupTrait.php).
Drupal\Core\Render\Markup::create(Array) (Line: 41)
html_titles_preprocess_block(Array, 'block', Array)
call_user_func_array('html_titles_preprocess_block', Array) (Line: 287)
Drupal\Core\Theme\ThemeManager->render('block', Array) (Line: 422)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 435)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 201)
Drupal\Core\Render\Renderer->render(Array) (Line: 479)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 51)
__TwigTemplate_d9bec94492b2424f341b9272bc33204312041e12ac3928c8731c7757eb947019->doDisplay(Array, Array) (Line: 405)
Twig\Template->displayWithErrorHandling(Array, Array) (Line: 378)
Twig\Template->display(Array) (Line: 390)
Twig\Template->render(Array) (Line: 55)
twig_render_template('modules/contrib/ds/templates/ds-1col.html.twig', Array) (Line: 384)
Drupal\Core\Theme\ThemeManager->render('ds_1col', Array) (Line: 422)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 435)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 435)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 201)
Drupal\Core\Render\Renderer->render(Array) (Line: 479)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 111)
__TwigTemplate_a39d6fc17455f2608c26d1a3c25c510eec9bb459200d1935ff87b24a451770bd->doDisplay(Array, Array) (Line: 405)
Twig\Template->displayWithErrorHandling(Array, Array) (Line: 378)
Twig\Template->display(Array) (Line: 390)
Twig\Template->render(Array) (Line: 55)
twig_render_template('themes/custom/proto/templates/content/node.html.twig', Array) (Line: 384)
Drupal\Core\Theme\ThemeManager->render('node', Array) (Line: 422)
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: 709)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Steps to reproduce

Enable module
Drupal Version 9.4.5
PHP Version 8.0.21

CommentFileSizeAuthor
#7 patch-issue-3302589.patch808 bytesDharmendra.s

Comments

proweb.ua created an issue. See original summary.

almador’s picture

Same problem here, but the error message looks little bit differ:

Warning: Array to string conversion in Drupal\Core\Render\Markup::create() (line 36 of core/lib/Drupal/Component/Render/MarkupTrait.php).

My setup is:
Drupal 9.5.1
HTML Titles for Drupal 8 - 8.x-1.0-alpha2

Dharmendra.s’s picture

Not able to reproduce. what is the exact flow to get that error, during node|block|taxonomy save.
My setup is:
Drupal : 9.4.8
PHP : 8.0.26
Mysql : 5.7.29

almador’s picture

Here is the full error code:

Warning: Array to string conversion in Drupal\Core\Render\Markup::create() (line 36 of core/lib/Drupal/Component/Render/MarkupTrait.php).

Drupal\Core\Render\Markup::create(Array) (Line: 41)
html_titles_preprocess_block(Array, 'block', Array)
call_user_func_array('html_titles_preprocess_block', Array) (Line: 287)
Drupal\Core\Theme\ThemeManager->render('block', Array) (Line: 433)
Drupal\Core\Render\Renderer->doRender(Array, 1) (Line: 204)
Drupal\Core\Render\Renderer->render(Array, 1) (Line: 160)
Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}() (Line: 580)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 161)
Drupal\Core\Render\Renderer->renderPlain(Array) (Line: 175)
Drupal\Core\Render\Renderer->renderPlaceholder('', Array) (Line: 665)
Drupal\Core\Render\Renderer->replacePlaceholders(Array) (Line: 550)
Drupal\Core\Render\Renderer->doRender(Array, 1) (Line: 204)
Drupal\Core\Render\Renderer->render(Array, 1) (Line: 148)
Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}() (Line: 580)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 149)
Drupal\Core\Render\Renderer->renderRoot(Array) (Line: 279)
Drupal\Core\Render\HtmlResponseAttachmentsProcessor->renderPlaceholders(Object) (Line: 128)
Drupal\Core\Render\HtmlResponseAttachmentsProcessor->processAttachments(Object) (Line: 45)
Drupal\Core\EventSubscriber\HtmlResponseSubscriber->onRespond(Object, 'kernel.response', Object)
call_user_func(Array, Object, 'kernel.response', Object) (Line: 142)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.response') (Line: 202)
Symfony\Component\HttpKernel\HttpKernel->filterResponse(Object, Object, 1) (Line: 190)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 81)
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: 50)
Drupal\ban\BanMiddleware->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: 713)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
almador’s picture

I'm not sure, but maybe in html_titles.module

$theme_registry['field__node__title']['path'] = drupal_get_path('module', 'html_titles') . '/templates';

should be replaced with:

  $theme_registry['field__node__title']['path'] = \Drupal::service('extension.list.module')->getPath('html_titles') . '/templates';

drupal-check

  Line   html_titles.module
 ------ -----------------------------------------------------------------------------
  15     Call to an undefined method Drupal\Core\Entity\EntityInterface::getTitle().
  16     Call to an undefined method Drupal\Core\Entity\EntityInterface::setTitle().
  23     Call to deprecated function drupal_get_path():
         in drupal:9.3.0 and is removed from drupal:10.0.0. Use
           \Drupal\Core\Extension\ExtensionPathResolver::getPath() instead.
  33     Call to an undefined method object::label().
almador’s picture

also when I'm trying to access the /admin/structure/views/view/taxonomy_term

the error appears:
TypeError: array_key_exists(): Argument #2 ($array) must be of type array, Drupal\Core\StringTranslation\TranslatableMarkup given in html_titles_preprocess_page_title() (line 52 of modules/contrib/html_titles/html_titles.module).

Dharmendra.s’s picture

Status: Active » Needs review
StatusFileSize
new808 bytes

Yes it was throwing the error on /admin/structure/views/view/taxonomy_term page , I update the code and working fine for me.
Please review the patch.

almador’s picture

Dharmendra.s thank you for the patch, I could confirm it's working

i-trokhanenko’s picture

Status: Needs review » Reviewed & tested by the community

i-trokhanenko’s picture

Status: Reviewed & tested by the community » Fixed

Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.