I installed `taxonomy_menu` and added a some vocabularies to the main navigation. But then i started to get this error

The website encountered an unexpected error. Please try again later.
Error: Call to a member function getDescriptionFieldName() on null in Drupal\taxonomy_menu\Plugin\Menu\TaxonomyMenuMenuLink->getDescription() (line 119 of modules/contrib/taxonomy_menu/src/Plugin/Menu/TaxonomyMenuMenuLink.php).

I tried deleting the menu links on the main navigation in the database but now i get this error.

The website encountered an unexpected error. Please try again later.</br></br><em class="placeholder">Drupal\Component\Plugin\Exception\PluginException</em>: Plugin (taxonomy_menu.menu_link:taxonomy_menu.menu_link.government.1641) instance class &quot;Drupal\taxonomy_menu\Plugin\Menu\TaxonomyMenuMenuLink&quot; does not exist. in <em class="placeholder">Drupal\Component\Plugin\Factory\DefaultFactory::getPluginClass()</em> (line <em class="placeholder">97</em> of <em class="placeholder">core\lib\Drupal\Component\Plugin\Factory\DefaultFactory.php</em>).

Not sure if clearing the main navigation would be the solution or something with the `taxonomy_menu` module.

Any assistance is very appreciated, thanks in advance.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jedgar1mx created an issue. See original summary.

jedgar1mx’s picture

I forgot to add that the main site menu can't not be edit manually anymore and the second error comes when i do a site search.

jedgar1mx’s picture

Seems that taxonomy_menu plugin still tries to get the description of deleted items.

I fixed it by replacing line 119 on modules/contrib/taxonomy_menu/src/Plugin/Menu/TaxonomyMenuMenuLink.php

$description_field_name = $taxonomy_menu->getDescriptionFieldName();

With:

if($taxonomy_menu != null){
      $description_field_name = $taxonomy_menu->getDescriptionFieldName();
    }
jedgar1mx’s picture

Title: Broken menu and search » Error when taxonomy_menu returns null
Assigned: Unassigned » jedgar1mx
FileSize
879 bytes
jedgar1mx’s picture

Status: Active » Needs review
andrey.troeglazov’s picture

andrey.troeglazov’s picture

Assigned: andrey.troeglazov » Unassigned
Status: Needs review » Needs work

As I see $description_field_name variable is used below, so if your patch is applied there will be notice of undefined variable.

Pranali.addweb’s picture

Assigned: Unassigned » Pranali.addweb
Snehal Brahmbhatt’s picture

Status: Needs work » Needs review
FileSize
762 bytes

@jedgar1mx @andrey.troeglazov, I have changed code to resolve "getDescriptionFieldName() null" and "undefined $description_field_name variable" issue. Kindly review my patch, hope this will work for you!..

Thanks!..

andrey.troeglazov’s picture

Assigned: Pranali.addweb » Unassigned

  • snehal.addweb authored b42c11f on 8.x-3.x
    Issue #3006108 by jedgar1mx, snehal.addweb, andrey.troeglazov: Error...
andrey.troeglazov’s picture

Status: Needs review » Fixed
andrey.troeglazov’s picture

Issue tags: +Taxonomy Menu Release 8.x-3.5

Status: Fixed » Closed (fixed)

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

DamienMcKenna’s picture

DamienMcKenna’s picture

Issue tags: -Taxonomy Menu Release 8.x-3.5