Hey, I am experiencing a weird behavior on a fresh Drupal 8.1 install with multiversion enabled.
When I manually add a link to the main menu (/admin/structure/menu/manage/main) it is rendered twice in the admin interface AND on the front-end after clearing all caches.
I believe this effect is produced by the menu link storage. Anyone else seeing the same weirdness?

Comments

alexej_d created an issue. See original summary.

jeqq’s picture

Assigned: Unassigned » jeqq

I can reproduce it. It duplicates internal links after cache clear. Working on a fix.

  • jeqq authored 22f1c8f on 8.x-1.x
    Merge pull request #84 from dickolsson/duplicate-menu-links-fix
    
    Issue #...
jeqq’s picture

Status: Active » Fixed
djidane35’s picture

Hi jeqq, I apply your changes :

- remove "$entity_type->setClass('Drupal\multiversion\Entity\MenuLinkContent');" in "multiversion.module" file
- remove "src/Entity/MenuLinkContent.php" file

and i reproduce yet the duplication. Are you sure that your fix is ok ?

Thanks in advance

jeqq’s picture

Thank you alexej_d and djidane35 for reporting and testing it. Reverted my commit and fixed this here.

djidane35’s picture

Thanks jeqq, this seems to work !

Status: Fixed » Closed (fixed)

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

djidane35’s picture

Status: Closed (fixed) » Active

Hi jeqq,

in fact your fix does not work when I use command "drush cr" wheras when i use link "Clear cache" from admin menu it works !

The problem is in "multiversion.module" file :

$menu_link_content_entities = \Drupal::service('entity.manager')
    ->getStorage('menu_link_content')
    ->loadMultiple($entity_ids);

With drush, $menu_link_content_entities is empty whereas with link "Clear cache" from admin menu, entities are loaded.

I feel that something is not loaded when I pass by Drush, what do you think about this ?

Thanks

djidane35’s picture

Ok I have found the problem.

All my website is developped on "Stage" workspace and it appears that Drush uses "live" workspace.

So, when I use admin menu, the selected workspace is "Stage" so all works good.

However, when I use drush, "live" workspace is selected and I have no data in this workspace.

Do you know how to select default workspace from drush ?

djidane35’s picture

Status: Active » Closed (fixed)

Patch works perfectly.