InvalidArgumentException: Field field_domain_all_affiliates is unknown

Created on 16 October 2024, 2 months ago

The issue occurred after replacing the domain menu block in the block layout:

InvalidArgumentException: Field field_domain_all_affiliates is unknown. in Drupal\Core\Entity\ContentEntityBase->getTranslatedField() (line 616 of core/lib/Drupal/Core/Entity/ContentEntityBase.php).

Drupal\Core\Entity\ContentEntityBase->get() (Line: 156)
Drupal\domain_menu_access\Menu\DomainMenuLinkTreeManipulators->isAvailableOnAllAffiliates() (Line: 130)
Drupal\domain_menu_access\Menu\DomainMenuLinkTreeManipulators->menuLinkCheckAccess() (Line: 88)
Drupal\domain_menu_access\Menu\DomainMenuLinkTreeManipulators->checkDomain()
call_user_func() (Line: 153)
Drupal\Core\Menu\MenuLinkTree->transform() (Line: 108)
Drupal\domain_menu_access\Plugin\Block\DomainMenuAccessMenuBlock->build() (Line: 171)
Drupal\block\BlockViewBuilder::preRender()
call_user_func_array() (Line: 113)
🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇯🇴Jordan Qusai Taha Amman

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @Qusai Taha
  • 🇯🇴Jordan Qusai Taha Amman

    I think we need to remove the isAvailableOnAllAffiliates function check

  • 🇷🇴Romania alex.stanciu

    The previous patch won't do it, because in case of a missing field, it just goes on to try to load it in line 132.
    An additional check before trying to load it fixes this problem, altough I didn't have much time to look into the original cause. If you want a quick solution to get you past this error, try the attached patch.

Production build 0.71.5 2024