Opening as a new issue since the other was closed...

Tried using the DEV version of the module, and everything was working great until I started putting a link under another link in my main navigation menu. The top level link simply went to the home page (using <front>) but the second level link went to a different content type that DID have an image field (not sure exactly what "image" has to do with this module, there isn't any explanation).

If I keep the link to the page as a top level link, it works fine. But as soon as I put it under another link, I get a total WSOD. The error log spits out three of the following:

InvalidArgumentException: Field body is unknown. in Drupal\Core\Entity\ContentEntityBase->getTranslatedField() (line 471 of <path>/core/lib/Drupal/Core/Entity/ContentEntityBase.php).

I'm a front end developer but in looking at the zt_megamenu.module file, on line 113, if I remove the following from the module:

if ($node->get('body')->value) {
      $body = $node->get('body')->value;
      $body = substr($body, 0, 100) . '...';
      $body = str_ireplace('<p>', '', $body);
      $body = str_ireplace('</p>', '', $body);
    }

then everything works correctly. It should be noted that the content type it is linking to does NOT have a body field on it.

I am not entirely sure at all how the image part of this ties in to anything, but there should be some sort of configuration option to disable the whole image/body/node preview functionality of this to give this module a lot more flexibility and prevent users from having to hack the module to make it work.

Please let me know if you need anymore help in figuring out the problem, and thank you for an otherwise awesome module!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

hotsaucedesign created an issue. See original summary.

jithin prabhakaran’s picture

Status: Active » Needs review
FileSize
889 bytes

The issue is fixed and the patch is attached.
Please review it.

zyxware’s picture

Status: Needs review » Fixed

Applied the patch.

Status: Fixed » Closed (fixed)

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