Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error on entity canonical page when there is no site resolver. #673

Closed
wants to merge 1 commit into from

Conversation

andrewbelcher
Copy link

@andrewbelcher andrewbelcher commented Feb 1, 2024

This pull request is for:

  • examples/*
  • modules/next
  • packages/next-drupal
  • starters/basic-starter
  • starters/graphql-starter
  • Other

GitHub Issue: #517

Describe your changes

As mentioned in #517, if you have an entity type configured that does not have a site resolver (or from the UI perspective, preview mode set to None), you get the following error on the canonical entity page:

Call to a member function getSitesForEntity() on null in Drupal\next\Render\MainContent\HtmlRenderer->prepare()

This is because HtmlRenderer assumes getSiteResolver() returns a SiteResolverInterface despite the signature (supported by the UI where you can select none) being:

public function getSiteResolver(): ?SiteResolverInterface;

This PR uses a null object accessor and switches to a falsy (empty array or null) check on the result.

Copy link

vercel bot commented Feb 1, 2024

@andrewbelcher is attempting to deploy a commit to the Chapter Three Team on Vercel.

A member of the Team first needs to authorize it.

@JohnAlbin
Copy link
Collaborator

Fixed by #481

@JohnAlbin JohnAlbin closed this Feb 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants