Installed and enable TB Mega Menu and receive following error when trying to configure main menu item:

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

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

Error occurs when trying to configure any menu item.

Found a related issue on drupal.org : https://www.drupal.org/node/2587167

Appears to something module related

CommentFileSizeAuthor
#7 2623306-TbMenu_translate_string.patch1015 bytesdoidd
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dougl created an issue. See original summary.

dougl’s picture

Title: Getting Error Code when clicking config "any menu item" » Error Code:The website encountered an unexpected error. Please try again later.
dougl’s picture

Issue summary: View changes
mzeyrek’s picture

I confirm having same issue even with fresh install of 8.0.1

ksavoie’s picture

Confirm, same issue, 8.0.1

Anticosti’s picture

Confirm, same issue, 8.0.1

doidd’s picture

- That problem because in file tb-megamenu-item.html.twig
variable link['title'] is object not string so can't use t .
- Try my patch

dougl’s picture

Applied patch and appears to be working correctly. Thanks for the help. Rookie (me) has finally applied a patch via git. Continuing to test and will report success/issues.

Anonymous’s picture

Status: Active » Reviewed & tested by the community

Applied patch and appears to be working correctly for me too.

Anonymous’s picture

I uploaded patch file to the directory which tbmegamenu folder resides. Which program and how I can apply that patch? I have no knowledge about patching.

geertvangent’s picture

Hey deniz_seaside,

First,

You need to find the file tb_megamenu.module under root/modules/tb_megamenu and add $vars['link']['title_translate'] = $item->link->getTitle(); below line 475 (this is the + in the patch file)

Second,

You need to find the file tb-megamenu-item.html.twig under root/modules/tb_megamenu/templates and remove {{ link['title']|t }} and then replace it with {{ link.title_translate|t }} (these are the - and + in the patch file)

Hope this helps

ChrisGrewe’s picture

I had the same issue with Drupal 8.0.3. Applied the patch, problem solved. Thanks!

geertvangent’s picture

Just a warning:

Updating the module causes the same error

besbous’s picture

Still seeing the same issue in drupal 8.0.5. Any pointer to a fix is appreciated.

doidd’s picture

Version: 8.x-1.0-alpha1 » 7.x-1.x-dev

Does anyone have source code of TB Mega menu 8? Please share with me!

marceldenouden’s picture

This patch is not working for my website, can somebody help or advice what to do now? Latest drupal version 8

error code php

Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AS expression FROM drup_ mlfr INNER JOIN drup_ mlr ON mlfr. = mlr. AND mlr. = ' at line 1: SELECT mlfr.id AS id, MAX(mlfr.) AS expression FROM {} mlfr INNER JOIN {} mlr ON mlfr. = mlr. AND mlr. = 0 INNER JOIN (SELECT t.id AS id, t.langcode AS langcode, MAX(t.) AS expression FROM {} t WHERE t. = :db_condition_placeholder_0 GROUP BY t.id, t.langcode) mr ON mlfr. = mr. AND mlfr.langcode = mr.langcode GROUP BY mlfr.id; Array ( [:db_condition_placeholder_0] => 1 ) in Drupal\menu_link_content\MenuLinkContentStorage->getMenuLinkIdsWithPendingRevisions() (line 41 of /home/feisty/domains/girlifornia.com/private_html/core/modules/menu_link_content/src/MenuLinkContentStorage.php).

quondam’s picture

Version: 7.x-1.x-dev » 8.x-1.x-dev
Status: Reviewed & tested by the community » Needs review

The version for this issue was incorrectly changed in #16; the original post, comments and patch all pertain to the D8 version of the module.

themodularlab’s picture

Issue tags: +translations
quondam’s picture

Status: Needs review » Fixed

The updates provided via the patch from #7 were added to the TB Mega Menu module's codebase back in September 2017 in this commit. I've re-tested to validate that this no longer appears to be an issue; since multiple responses above also confirmed that the patch resolved the issue - and there aren't any open translation-related issues for the module at the time of writing - it seems safe to call this one fixed.

Status: Fixed » Closed (fixed)

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