Thank you for creating a great very useful module.

I'm having an issue when I stack firstchild menu links in Drupal 8.

example menu:

Menu Link1
-Menu Link2
--Menu Link3
---Menu Link4 attached to node

Only Menu Link3 works.

Menu Link1 and Menu Link2 have an empty href (href="").

Stacking firstchild links used to work in Drupal 7 but now not in Drupal 8 it appears.

Is this a known issue or any workarounds please?

Comments

Trevor-NZ created an issue. See original summary.

pingevt’s picture

Status: Active » Needs review
StatusFileSize
new1.92 KB

D8 module was pretty much a re-write. And when we worked on translation issues, there were some major changes. So no this was not known.

And seems completely reasonable. Here is a patch. Let me know how this works for you.

pingevt’s picture

Trevor-NZ’s picture

Thank you so much.

Yes your patch has fixed the stacking issue!!

FYI I do get these now in Drupal Reports page:

Notice: Trying to access array offset on value of type null in Drupal\menu_firstchild\MenuItemParser->getFirstChildRecursivly() (line 179 of /home/public_html/modules/menu_firstchild/src/MenuItemParser.php)

And also:
RuntimeException: Failed to start the session. in Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage->start() (line 155 of /home/public_html/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php)

I'm not too sure if they are related.

Thanks again for your help!

pingevt’s picture

StatusFileSize
new1.63 KB

Ah - the first one makes sense. I think this would happen if you have a menu item saved before enabling menu_firstchild. But regardless, the check for the array should be there.

The second one, the RuntimeException I'm not entirely sure. I did notice I left in a debug statement. So that could potentially be an issue. If it is still there with this patch, I will need to know more about your current setup.

Try this patch, and please let me know. Thanks.

Trevor-NZ’s picture

Thank you so much the latest patch (5)

It appears to have fixed both the notice and the RunTimeException!

I'll report back in a couple of days to confirm that all is good.

Thanks again for your help with this.

pingevt’s picture

Status: Needs review » Fixed

Assuming this was fixed since there was no follow up

  • pingevt committed c3a1a68a on 2.x
    Issue #3197903 by pingevt, Trevor-NZ: Stacking FirstChild links
    

  • pingevt committed 784a6654 on 2.x
    Issue #3197903 by pingevt: Stacking FirstChild links test
    

Status: Fixed » Closed (fixed)

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