Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment | File | Size | Author |
---|---|---|---|
#7 | 2623306-TbMenu_translate_string.patch | 1015 bytes | doidd |
Comments
Comment #2
dougl CreditAttribution: dougl commentedComment #3
dougl CreditAttribution: dougl commentedComment #4
mzeyrek CreditAttribution: mzeyrek commentedI confirm having same issue even with fresh install of 8.0.1
Comment #5
ksavoie CreditAttribution: ksavoie commentedConfirm, same issue, 8.0.1
Comment #6
Anticosti CreditAttribution: Anticosti commentedConfirm, same issue, 8.0.1
Comment #7
doidd CreditAttribution: doidd commented- 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
Comment #8
dougl CreditAttribution: dougl as a volunteer commentedApplied 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.
Comment #9
Anonymous (not verified) CreditAttribution: Anonymous commentedApplied patch and appears to be working correctly for me too.
Comment #11
Anonymous (not verified) CreditAttribution: Anonymous commentedI 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.
Comment #12
geertvangent CreditAttribution: geertvangent as a volunteer commentedHey 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
Comment #13
ChrisGrewe CreditAttribution: ChrisGrewe commentedI had the same issue with Drupal 8.0.3. Applied the patch, problem solved. Thanks!
Comment #14
geertvangent CreditAttribution: geertvangent as a volunteer commentedJust a warning:
Updating the module causes the same error
Comment #15
besbous CreditAttribution: besbous commentedStill seeing the same issue in drupal 8.0.5. Any pointer to a fix is appreciated.
Comment #16
doidd CreditAttribution: doidd commentedDoes anyone have source code of TB Mega menu 8? Please share with me!
Comment #17
marceldenouden CreditAttribution: marceldenouden commentedThis 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).
Comment #18
quondam CreditAttribution: quondam at Bounteous commentedThe version for this issue was incorrectly changed in #16; the original post, comments and patch all pertain to the D8 version of the module.
Comment #19
themodularlabComment #20
quondam CreditAttribution: quondam at Bounteous commentedThe 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.